However, as soon as I move the mysql server to another machine it takes at least 30 seconds - sometimes minutes.
In my experience nearly all problems like "connecting to service X is very slow" are caused by DNS misconfiguration. I bet that MySQL service is configured to resolve client IP and DNS server it uses for DNS lookups cannot resolve this IP. So MySQL server had to wait for DNS query timeout. Solution: either disable DNS lookups in mysql or fix DNS.
--
Ilya Martynov, ilya@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support
UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org
| [reply] |
Perhaps showing us some code, would enable us to give some more detailed answers. May we suggest the following:
- Write a minimal DBI-program (just connecting, fetching some data and disconnecting).
- Run it on a machine with mySQL local and time it.
- Then run it with mySQL on a different machine and time it again.
- Report back to Perlmonks, with your code and timings.
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] |
Coming at it from the perl angle, run your script under DProf:
perl -d:DProf script.pl
and then use dprofpp to see which perl subroutine is causing the delay. From that you may be able to figure out where the problem lies.
See Devel::DProf for more details.
dave hj~ | [reply] [d/l] [select] |
I'm new to all this stuff so be gentle :)
If you remove that bullseye from your forehead, I won't shoot.
Does anyone have any ideas where to look or which logs/performance stats to check?
Yeah, first look at your code. How much data are you retrieving? How do you process it? (one record at a time, or all records at once) Caching any of it? (can you make use of caching) Check your error logs for errors, check your mysql logs for errors, try profiling your code, try profiling your mysql.
| [reply] |