Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2006

Tip: Looking for answers? Try searching our database.

MySQL 5 slow startup

Thread view: 
ralph - 25 Jan 2006 11:08 GMT
Hi,

I have a Java app that starts a standalone instance of MySQL.

Since I upgraded from MySQL 3.2 to MySQL 5.0 on some machines
it takes more than 30 seconds after the start of the
MySQL-process until it is possible to connect to the database.

On other machines with the same hardware configuration there
is no noticeable speed difference between the two versions.

Can anybody tell me why on some machines MySQL 5 needs so long
until it is ready for connections?

When I used MySQL 3.2 I started mysqld-opt.exe. Since that
seems not to be available in 5.0 I'm using mysqld-nt.exe now.

All machines are running Windows XP.

TIA

ralph
Roedy Green - 25 Jan 2006 14:03 GMT
>On other machines with the same hardware configuration there
>is no noticeable speed difference between the two versions.

if this is really important, MySQL is opensource and you could put
some debug printouts in the initialisation code to figure out what is
taking all the time.  Are they both loading the same database? Do they
both have the same amount of RAM?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

David Harper - 25 Jan 2006 22:15 GMT
> I have a Java app that starts a standalone instance of MySQL.
>
[quoted text clipped - 4 lines]
> On other machines with the same hardware configuration there
> is no noticeable speed difference between the two versions.

Have you checked the server log file to see the messages that are
written at server startup? These can often give useful clues when there
is a problem.

David Harper
Cambridge, England
ralph - 26 Jan 2006 07:31 GMT
> Have you checked the server log file to see the messages that are
> written at server startup? These can often give useful clues when there
> is a problem.
>
> David Harper
> Cambridge, England

This is the MySQL-Log-File:

 060126  8:04:15  InnoDB: Started; log sequence number 0 43655
 060126  8:04:16 [Note] D:\MyProject\mysql\bin\mysqld-nt.exe: ready
for connections.
 Version: '5.0.18-nt'  socket: ''  port: 3306  MySQL Community Edition
(GPL)
 060126  8:04:50 [Note] D:\MyProject\mysql\bin\mysqld-nt.exe: Normal
shutdown

 060126  8:04:50  InnoDB: Starting shutdown...
 060126  8:04:54  InnoDB: Shutdown completed; log sequence number 0
43655
 060126  8:04:54 [Note] D:\MyProject\mysql\bin\mysqld-nt.exe: Shutdown
complete

This logs tells me that the db was ready for connections 1 second after
it was started.
(What is InnoDB?).

But the log of my program says that it took 20 seconds:

 08:03:54 - starting database:
   "C:\mysql\bin\mysqld-nt.exe" "--basedir=C:\mysql" --standalone
--port=3306 --max_allowed_packet=128M
 08:03:54 - connecting to database:
   URL=jdbc:mysql://localhost:3306/trigonis
   user=root
   ..............
 08:04:16 - connection succeeded:
   dbms=MySQL 5.0.18-nt
   driver=MySQL-AB JDBC Driver mysql-connector-java-3.1.12 ( $Date:
2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )

I start mysqld-nt.exe using the ProcessBuilder class. Then I try to
connect. Whenever the connection fails I print a dot and sleep for 500
milliseconds.

I also tried to create a socket for port 3306. That fails too if I try
do create it within the first 20 to 30 seconds after starting the
process.

This happens only on some machines. On other machines the time between
starting the process and a successful connection is less than a second.
With MySQL 3.25 everything worked fine on all machines. All machines
are identical. The users' profiles may differ.
David Harper - 26 Jan 2006 15:20 GMT
[SNIP]
> This logs tells me that the db was ready for connections 1 second after
> it was started.
> (What is InnoDB?).

InnoDB is one of MySQL's storage engines. It provides transactional
capabilities, referential integrity and other features that some people
deem essential in a mission-critical database.

If you're not actually using InnoDB tables, then you can switch this
feature off via a line in the server configuration file or with your
favourite GUI config tool. This should make the MySQL server start up
much faster.

> But the log of my program says that it took 20 seconds:

[SNIP]
> This happens only on some machines. On other machines the time between
> starting the process and a successful connection is less than a second.
> With MySQL 3.25 everything worked fine on all machines. All machines
> are identical. The users' profiles may differ.

But *are* all the machines identical? If they are being used by
different people, then all bets are off!

Is it possible that the machines on which the MySQL server is slow to
start accepting connections have many background processes running? If
these processes are using a lot of memory, then the MySQL server must
compete with them to grab enough memory for itself, so that it can go
through its startup procedure, allocate the memory buffers that it
needs, and load its privilege tables.

My experience with Windows is that all kinds of crap starts up in the
background without the user really being aware of it, and each of these
background processes grabs ten or twenty megabytes of memory, so before
you know it, there's very little free memory.

In such an environment, MySQL may have difficulty getting enough memory
to allocate its buffers.

That may explain the delay.

David Harper
Cambridge, England
Roedy Green - 27 Jan 2006 00:39 GMT
On Thu, 26 Jan 2006 15:20:24 GMT, David Harper
<devnull@obliquity.u-net.com> wrote, quoted or indirectly quoted
someone who said :

>My experience with Windows is that all kinds of crap starts up in the
>background without the user really being aware of it, and each of these
>background processes grabs ten or twenty megabytes of memory, so before
>you know it, there's very little free memory.

You see them with a Ctrl-Alt-Del to bring up the task manager. Sort by
memory usage to see the pigs.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.