Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as not constructive by Ward, rnxrx, Magellan, Scott Pack, John Gardeniers Oct 16 '12 at 13:19

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

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.

share|improve this answer
    
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. –  Indianer Oct 12 '12 at 7:10
    
Is there any other solution for polling using a shared host? –  Indianer Oct 12 '12 at 7:13

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....

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.