Jump to content

Are queries made on a shared host, done per account or across all accounts ?


Newbeeeee

Recommended Posts

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 by Newbeeeee
Link to comment
Share on other sites

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.  

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.