-1

Hi there we are developing a website for students for taking Online tests. We are working on PHP My SQL. The questions of the all the tests are stored in a table with the test_id associated with the test. Problem: Now as the questions of the tests are being loaded from the server it sometime takes time in loading. As these tests are being TIMED (Online Tests) hence the test taker feels his time is getting wasted.

The loading time may be a result of
slow internet connection Databse search Question/s What is the best way of giving a jerkless experience to the test-taker irrespective of his internet speed and PC configuration.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345

2 Answers2

0

From your wording, I'm assuming each individual question has its own time limit.

Eliminating a user's slow connection is impossible; if you measure the time on the client to try and avoid that, you open it up to cheating (client can hack the javascript to present a false time).

However you can eliminate database query time: set up a websocket server, have the user connect to it when they start the test, load all of the relevant questions in advance on the server into a queue, and when the user requests a question, immediately record the current time and send the next question from the queue out via the websocket connection.

Also make sure that upon receiving the question, the client side JS displays it immediately and doesn't have to e.g. make further AJAX calls or requests before it can display it. If additional information is needed, that should be looked up by your websocket server and bundled in with the question.

By doing this you should be able to get the response time below 50ms if the user has a decent internet connection and is in the same country as your websocket server.

Keiji
  • 880
  • 5
  • 12
0

You can not speed-up loading regardless of the users internet-connection. Of course, you can (and should) optimize all SQL queries and long-running tasks to have them perform as good as possible.

To void issues with test time running out, I would recommend to load all questions before the time starts running. Then, all data can be stored in the clients local storage (refer this link for some more info) - but please take into account, that this will only work if the browser supports local storage.

Another possibility is, to load / generate all data and have some server-side cache (like memcached, or a simple file-cache). On every new action, that cache can be queried without having to query all data from the database. Of course, this will only speedup the process, if the performance issues are in long-running queries, database speed etc - not if the user`s internet connection is too slow.

dhh
  • 4,289
  • 8
  • 42
  • 59
  • Thanks Once Again!!! You have shown us the path. We will try HTML 5 first and then Memcached. – Abhishek Jain Jun 24 '15 at 08:04
  • Glad I could help ;-) Please do not forget to mark the answer as accepted if it helped you! – dhh Jun 24 '15 at 09:22
  • Hi am back is it possible to store all the questions in the session itself as we do not need it afterwards. Then we start the test only once loading of all the questions is done in the session on the client side. – Abhishek Jain Jun 24 '15 at 09:59
  • Of course you can store the data in the session - though I am not sure if that makes sense. Please make sure, that the session handler is able store the amount on data. The max. size depends on your session handler (memcache, file, database, etc.). For further information just check other threads regarding this topic (http://stackoverflow.com/questions/4274955/are-there-limits-for-session-variables, http://stackoverflow.com/questions/3202900/what-can-be-the-maximum-size-for-the-session, http://stackoverflow.com/questions/217420/ideal-php-session-size). – dhh Jun 24 '15 at 10:42