samedi 21 mars 2015

Syncing data across clients with a limited set of tools (no websockets, limited number of threads)

Goal I'd like to achieve


I need to implement some kind of server -> client communication. Namely, there are a set of objects (certain users lock some cells in a table) and users can simultaneusly lock cells. I'd like locked cells to be synced to the other users viewing the same page. I count with 45-50 users at least. (There are multiple tables (on a limited number of separate webpages, loaded with AJAX - transferred using JSON which I encode server-side.)


Limitations, resources and ideas



  • I have no bandwidth and disk space limitations. The available server's Disk IO is 2MB/s, Memory is 768MB (this is all available).

  • I must support an old version of Chromium (I believe 3) that does not support websockets. I must fall back to Long-Polling or any other technique.

  • The webpage runs on a shared hosting with the limitation of 15 PHP Processes. This means that using the standard long-polling technique could only support maximum 7-8 people on the page, which is not enough for this project.

  • Node.js is not available with this hosting provider.


I had the following idea:


Using a frequent running CRON Job I can generate and write the json strings to files - clients can download the json files periodically and update the table if there is a change.


I know that does not sound very elegant, so I decided to ask around before I implement the plan above.


Thanks for any ideas/help, Bálint





Aucun commentaire:

Enregistrer un commentaire