0

I am planning on writing a small browser game.

The webserver is a shared server, with no root / install possible.

I want to use AJAX for client/server communication. There will be 12 players.

So each player would be polling the server for the current game status every X milliseconds (let's say 200ms). So that would be 200ms x 12 players x 5 = 60 requests per second

Can Apache handle those requests?

What might be the bottlenecks when using this attempt?

2 Answers 2

1

The bottleneck is that your shared hosting provider will kick you off for hogging the CPU.

Apache can handle hundreds or thousands of requests per second, depending on the server and any performance tuning in place. The problem is that for "obtaining game status" you're going to hit your application, which is going to do some calculations, which is much harder to serve. You might only be able to do dozens of these per second if you had the server all to yourself.

A solution there is to do the status calculation in a background worker, write a file with the status every second or half second or whatever, and have your AJAX fetch that file.

Though, if your game is even marginally successful, you'll have to move off shared hosting and onto something more reasonable. Shared web hosting is not really designed for high performance or mission critical web sites.

2
  • Indeed they warned me alread "too many hits". But legally there is no limit set in the contract, so... I will think about the bg worker doing the calc. Till now I have only thought about the server requests and performance and not the game logic in it being the bottle neck.
    – Shlomo
    Oct 12, 2012 at 7:10
  • Is there any other solution for polling using a shared host?
    – Shlomo
    Oct 12, 2012 at 7:13
0

Apache can easily handle 60 requests / second. The rest depends on what you want to do exactly, is it doing alot of MySQL queries, etc.

Besides that define "shared" server. What are the limitations set on it....

Not the answer you're looking for? Browse other questions tagged .