MYSQL as localhost

TheWebMistress

New member
Heyha, I have one account with a hosting company at the moment who have all their databases hosted on seperate machine instead of localhost. Im noticing lags when doing some db admin.
What are your views on db as localhost?
 
Really depends, if not running the mysql on the same server. You should at least have an extremely good connection to the sql server.

And it should also be a good reason for it also, maybe that the site is so demanding that it can not handle both sql and http request at once.

What control panel you got on your hosting ?
 
Mysql cluster server usually handles load and process much effectively than a localhost server. The mysql service configuration at such a server should be well optimized as in accordance with the number of connections, users etc. in the my.cnf file.
 
I always prefer separate database and web servers. Much more better to run all on one server. However, as mentioned above, you will need a good connection between them. We utilize gigabit connections in the same LAN and no complain from customers at all.
 
Indeed, a problem may be the connection between the two servers. But the mysql slowness can just as well be due to the heaviness of the job, or the load already placed on the server by other users.
 
You might want to consider tweaking your my.cnf file as well as optimizing your tables and rewriting your queries for best performance.
 
localhost is great for small databases, but if you are running large databases, or generating a lot of visits to the site, utilizing a second machine is usually a benefit.
 
In my opinion you can't really compare a locally hosted mySQL service and a remotely hosted mySQL service.
Clearly accessing your databases directly from the same disk is going to be faster than accessing your databases from a remotely hosted mySQL service.

:smash:
 
alternatively you could use both and split the duties. What I mean is that you can replicate the db onto the localhost and use it only for reading purposes. Any writes would happen at your offsite db server and would trickle down to the localhost when it repilcates.

Its not as complicated to set up as you might think and could work well for your needs. Its most often used by voip companies running multiple servers that handle calls.
 
It's pretty common for most shared/reseller environments to use locally hosted MySQL, and usually there are no issues. Chances are, if a website has a database so large that it needs to be hosted on a standalone SQL server, it probably isn't suited for a shared Apache server anyway.

It really depends on the configuration and size of the site. However, unless there is a definite NEED for it, I think its much simpler and more efficient to use one server for both web + mysql.
 
Heyha, I have one account with a hosting company at the moment who have all their databases hosted on seperate machine instead of localhost. Im noticing lags when doing some db admin.
What are your views on db as localhost?

In my experience, dedicated mysql servers always perform better than it being on a local machine, especially if there is load on the main machine.

Maybe the database server itself is overloaded, although, I find that hard to believe!
 
They might be running some big servers with heavy DB usage so they had isolated the DB into a separate server, its a good technical move, if you face some delay in this you can ask them but overall its a good plan
 
In my opinion you can't really compare a locally hosted mySQL service and a remotely hosted mySQL service.
Clearly accessing your databases directly from the same disk is going to be faster than accessing your databases from a remotely hosted mySQL service.

:smash:

As a blanket statement, I don't think so. Yes for minor databases, the lack of a network may be faster - provided the machine isn't underpowered and/or overloaded. However it is quite common to move databases to their own server in larger environments. For high transactional volume, the configuration of a web server and a database server will be radically different... In terms of the 'average website' you are probably correct. But for high tx work, probably not. It at least goes against the prevailing dba wisdom anyway.

For reliability and speed, a typical webserver will run RAID10 arrays. Most database servers run RAID5 or even 5+1 (RAID5 mirrored). The more spindles you can throw at a database the better. I admin a db server with 24 spindles - RAID1 boot, RAID10 os/apps, and RAID5+1 data.
 
I think it really depends. If you have a big number of simple queries (easily resolvable by table keys) for not so relevant data (daily backup suffices), you might want to avoid the delays caused by network latency and stick with the local db. Security is another issue. If you need security and can't secure the network between host and db, you will start thinking of encrypted links; expensive and slow. And last, another network component is another degree of complexity and potential source of failure.

There will be good reasons to use external db hosts, but it needs thorough thinking. Anyway, I agree absolutely that a good admin must consider the options.
 
Top