On Thursday 21 December 2006 11:03, Scott Haneda wrote: > > Hello, > > > > I have been using mysql_connect in a script that display a lot of > > thumbnails for an album. Each thumbnail is displayed using the code: > > > > <IMG SRC="thm.php?id=some_id ALT="some title"> > > > > thm.php use a mysql_connect to the database to access the info about the > > picture based on the id. > > > > This worked fine. However, the SQL server is located on a different > > network than the web-server with a firewall between. When I looked into > > the firewalls log I saw that there was large amount of new connections > > when someone accessed the page where all the thumbnails was displayed. > > > > I then changed mysql_connect to mysql_pconnect on the scripts and > > viola... the amount of new connections to the SQL server dropped to only > > two. > > > > Good, I thought. But later I discovered that the SQL server had a large > > amount of childs running. I had 50-60 mysqld running on the system. This > > number was constant to below 10 before I changed to persistent mode. > > > > Any settings in the config file for the sql-server I need to be aware of? > > > > I'm using MyISAM tables . > > I would have to say, this is suboptimal, and perhaps a little OT, but here > goes. If you have 50 images, you are going to make 50 selects to your > database, depending on how you connect, you may make 50 connections, or > not.
First, I know that this may be a bit OT. > What you should do, is grab the 50 images ahead of time, in one select, and > use some php to iterate them and display them. Second, your suggestion is not an option in my case, since the image and the thumbnails are not stored in the database. The database contain image id, image attributes (exposure++) and name of the image and thumbnail file. I have looked into the docs about configuration, and there is parameter called wait_timeout, which is set to 28800 (8 hours). I have not tested it yet, but perhaps this should be set to something much lower? -- Jørn Dahl-Stamnes homepage: http://www.dahl-stamnes.net/dahls/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]