It was necessary to make a simple extension for chrome, where I need to get data there instantly at the initiative of the server. I read a lot about it, comet, webSockets, etc. But all this requires vps or vds. For my task, buying a server is stupid, since for the time being I do not plan to earn something on it and I feel sorry for paying for the server, even if vps are not very expensive. A simple web hosting service is almost free for me. I began to think about how to do without these tools and I have only one option in my head, this is a constant survey of new developments on a DB, but the way I need the minimum return time and it’s quite possible that I’ll have enough users (even if 1k - in this case there is already a lot, but I think it will be more) and the extension will always work when the browser is open, then I’m afraid of a very high load (let's say if I poll once every second, although for me this is already a lot).

The requests themselves will be simple and the table polled is also quite small, but due to the large number I am afraid the server will not cope.

Tell me, am I truly afraid? Or will not such a strong load be? Still, a small request to check from a tiny table (select by a specific ID and the presence of new events, if there is one, we retrieve it and send it to the user). Tell me, how can you solve this issue without having to buy a server?

  • What does "regular hosting" mean? - zb '
  • well, the simplest web hosting - defender057
  • I think the "usual" refers to the support of mysql, php? but on which there are no vps or vds. Normal hosting at the lowest price? - IVsevolod
  • just like that - defender057
  • on search for free vps for example - zb '

1 answer 1

Fearing right. You can not underestimate users, you may think that you have 50 of them per day and they use your portal an hour a day. However, if you display some information once a second, it is likely to be event-driven and users may wait for it. In practice, all this translates into a dozen tabs with your portal, left overnight. Those. one person may accidentally or intentionally create a load that your service simply cannot handle.

Moreover, you almost can not control AJAX, let's say you have determined that the frequency in one second is too large and you want to reduce it to one time in 10 seconds. But it is already late, users have already opened a dozen tabs (half of which, because of the abundance of already open tabs, they don’t even see), and they hammer once a second, since the polling frequency is set on the JS side.

In general, for some time everything will work, however, if problems start, it will be extremely difficult to solve them.

  • Is it possible to include a script only if the tab is in focus? - Andrey Dinevich