Newbeeeee Posted November 6, 2018 Share Posted November 6, 2018 (edited) I just wondered if anyone knows of a site that can give me more information on the way MySQL actually processes the queries made from any account on the server. What I am wanting to know is, if a server has multiple sites are the queries processed in strick order for each account or across all account quries made ? Edited November 6, 2018 by Newbeeeee Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 6, 2018 Share Posted November 6, 2018 Mysql is a high concurrency database. It processes the requests as soon as it gets them. Quote Link to comment Share on other sites More sharing options...
gizmola Posted November 7, 2018 Share Posted November 7, 2018 MySQL doesn't have a concept of a "site". It has connections, users and databases. All MySQL can do is accept queries and process them. A PHP application looks the same as a NodeJS application, looks the same as a dba sitting in the mysql command line client issuing sql statements on the fly. MySQL gets the SQL statements and processes them. To add to benanamen's explanation, there will be a mysql server running somewhere. Often I have seen a dedicated server or set of servers configured, so the mysql server is often not on the same server as the web accounts. An associated mysql user account gets created, and permissions are set up so that any databases created are owned by that user. You of course are disclosed the username, connect string and password for your account which you configure in whatever applications you have that utilize the MySQL client libraries to connect. After that, any connections your application make work exactly the same as if you had your own server or cluster of servers. What the hosting company can do is control things like the # of connections you are allowed to make, so as to limit your application on that basis, but as far as the individual connections are concerned, they are all equal from the point of view of the mysql server, and as described -- it's a "First In" queue. I hesitate to say FIFO queue, because queries are not equal, and mysql will return the results as soon as it has them, so a long running query could come in first, and other shorter queries could come in after and be serviced with a result before the long running query. If you have a specific question or concern, it might help to elaborate on that. Quote Link to comment Share on other sites More sharing options...
Newbeeeee Posted November 10, 2018 Author Share Posted November 10, 2018 gizmola: Thankyou for your detailed reply. The one thing I do know is that the servers are separate. The last paragraph in your reply is the bit that I think has answered my question. In that its a FIFO, but only on short queries. So the answer being that it can run multiple queries at the same time while another is still finishing off is what I was after. I could be more specific in my question as I did not know that correct phrases to use. Thank you again for your reply. Quote Link to comment Share on other sites More sharing options...
dalecosp Posted November 12, 2018 Share Posted November 12, 2018 Just for additional info, MySQL's max_connection variable has a lower limit of 1 and a max limit of 100000, and the default value for all recent versions of MySQL is 151. We run max_connections=250 on a VM that hosts 4 sites with moderate traffic and about 60 more that get very little. We occasionally have "too many connections" errors, generally when some bot comes by that doesn't read Robots.txt (or a new one that we've haven't added there). 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.