开发者

Improving network latency - online gaming site

I operate an online browser game that is very AJAX/database dependent, and the problem I am encountering is excessively high latency during peak hours.

I've created a simple AJAX ping that checks the server in a per-second loop, and the execution/response times of the 5 most recent pings are averaged into a "Connection Speed" that is displayed on the screen.

Most times, this latency records anywhere from 100-350ms, depending on internet speed, the client's other running webpages, and various other t开发者_如何学编程hings. However, during peak hours on my server, namely 10PM-11PM EST, this latency becomes so bad that my AJAX functions stop working. The latency during these times can be around 2000ms, with some people seeing it as high as 6800ms.

My question is.. what would be the most likely cause of this? Is it a hardware issue on my server? Is it just unfeasible to create a browser game purely powered by AJAX? During these times, I often encounter issues on the server itself, with my control panel returning many "Cannot allocate memory for selected task" errors, yet when I run free through SSH, not even 10% of the RAM is being used.


You are experiencing contention somewhere in your web app or database. This can be in so many places and therefore has so many possible resolutions that it is impossible to list them. Some of the things you can think about:

  1. No threads available to handle incoming requests because they are making synchronous calls to the database which will lock the thread until the database returns thus increasing latency
  2. Contention at the databse level. Are you using partitioning for your data to support true concurrency?
  3. Are you serving static content through your web app which could be retrieved as a directly addressable resource?
  4. Are you load balancing your web app?
  5. Are you using caching on the web app?

It's a bit like "how long is a piece of string?"

Hope this helps some.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜