runthis Posted July 24, 2011 Share Posted July 24, 2011 (edited) Lame, i mispelled in the title. In the long run, how many queries on a game would be too many? Assuming the queries are optimized. In an ajax game this number would most likely be increased, but in this day and age, what is really just too many? Basically when the cpu load is super high eh? Edited July 24, 2011 by runthis Quote Link to comment Share on other sites More sharing options...
Lithium Posted July 24, 2011 Share Posted July 24, 2011 there is not a straight answer to that, as it depends on the server, how it prioritizes the requests, the mysql settings (max connections, etc), the queries themselves and how they are constructed... overall there is no way on answering to that without a full knowledge on the environment that the db's are running. Quote Link to comment Share on other sites More sharing options...
runthis Posted July 25, 2011 Author Share Posted July 25, 2011 Lets assume everything is standard, apache 2.2 on an average server with no other websites using latest php/mysql. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted July 25, 2011 Share Posted July 25, 2011 Again there is no single answers. For a short answer: too many queries is when the game starts to be slow. Now you could have one single slow query or many very fast one... so all depends on your design we can't answer like that. Quote Link to comment Share on other sites More sharing options...
Dominion Posted July 25, 2011 Share Posted July 25, 2011 (edited) To be honest it's not just your queries you should be worrying about as it's one part of it, you should time the execution of your scripts to see if they are slow for any reason. Of course there is no set bench mark for this (that I really follow anyway), but if something like a query or a loop is 90% of the load time it's then fairly easy to see that's what you should be looking into to. You can also have a read over this - http://makewebgames.io/showthread.php/38020-Code-profiling Edited July 25, 2011 by Dominion Quote Link to comment Share on other sites More sharing options...
SirChick Posted March 26, 2012 Share Posted March 26, 2012 (edited) As many as you need is the correct amount. An ajax game would not increase it at all. IF you had to query two tables for the something, there really should be some kind of join between the two thus making it just one query. Edited April 6, 2012 by SirChick Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 26, 2012 Share Posted March 26, 2012 If in doubt enable slow log queries and use mytop if the situation is really bad. I can highly recommend if you can use splunk Quote Link to comment Share on other sites More sharing options...
Spudinski Posted March 26, 2012 Share Posted March 26, 2012 There isn't something such as too many queries. A single query could be made up of five or ten sub-queries. As long as you are using your DBMS wisely and optimize your queries as best possible, you can have millions within a single application. Another thing, you do get to a point within your application where queries begins to be resource intensive. That is the point where you rethink your current database design, and implement either a query cache, use DBMS replication servers or implement a load balancing scheme. I'd say if your query executes in less than a second on average, you're doing quite all right. (Note: this depends on many factors, but for un-indexed tables an average of 2.5s on complex queries is completely normal) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.