Jump to content
  • Advertisement
Sign in to follow this  
Legendre

Is this too much "traffic" for PHP/MySQL?

This topic is 2325 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been learning PHP and MySQL, and wrote some simple games using them (single player text adventure, simple RPG etc). Now, after learning how to and writing my own login and chat system, I am thinking of expanding it into a simple "kingdom management" multiplayer browser game. Basically it goes like this:

1) There is an MySQL table for the "country" that each player controls containing how much Land, Soldiers (several types) and Gold they have.
2) Each country receives 1 turn every hour. They can keep it, or spend it to get more Land, Soldiers, Gold or attack other countries.

I think the programming is straightforward: after logging in, players go to a webpage with HTML forms that allows them to input how many turns they want to spend acquiring Land/Soldiers/Gold. When they click submit, a connection is made to the MySQL table and the respective entries are modified.

My question: If 50 players log into my game and start playing, will there be "too much" MySQL activity that generate lag or bandwidth issues? (on basic shared hosting right now, its just a small scale hobby project) It feels like there will be a lot of connections made to the database and a lot of reading/writing of the data. Am I doing it the "right" way or is this too inefficient?

Share this post


Link to post
Share on other sites
Advertisement
You can use 'persistent' or pooled connections from the web service to the database, where different sessions share a pool of connections between them.

See: http://php.net/manual/en/function.mysql-pconnect.php

Usually your database will be on the fast internal network, so I wouldn't worry about bandwidth problems. There are a lot of things you can do to achieve better performance such as optimising the PHP, using carefully placed table indexes or even using a distributed MySQL database with the NDB (cluster) storage engine. But remember that these are only worth thinking about when you know for sure where the bottlenecks are in your particular system.

In any case, 50 players will not be a problem.

Share this post


Link to post
Share on other sites
If you don't write really bad code, 50 players won't be an issue at all. Scaling issues generally start in the hundreds or thousands of concurrent users.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!