Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What is the best way to have a web server using apache 2 / rails / Phusion Passenger connect to a separate mysql db server. Right now im using MySQL TCP socket on port 3306 for them to communicate and I think it may be causing an increase in load time.

share|improve this question
add comment

2 Answers 2

If by "separate" you mean "on a separate machine", then TCP is your only option. Yes, talking over a network is slower than talking over a local socket, but unless you're doing something unwise like opening and closing the DB connection for every query on a page, then the increase in page load time will be unnoticable.

share|improve this answer
add comment

You'll see an increase in load time, but it's the only way to have them on different machines and talking to one another. Are the machines adjacent? Can you use a 2nd network connection on each machine? That should reduce the latency.

Also, make sure you're using persistent connections and making use of caching. Those are just smart changes to make no matter where your database server is located.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.