You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Samuel Vogel <sa...@gmx.de> on 2007/10/31 20:51:54 UTC

[users@httpd] Logging to a MySQL Database

Hey guys,

I am running Apache 2.2 and did try out mod_log_mysql to make my logs to 
to an mysql table. Unfortunately I do run apache in prefork mode and in 
peak times, there are arround 700 processes running.
The bad thing is that mod_log_mysql makes a new mysql connection for 
every single thread. This is not just causing a major mysql slowdown but 
also neither myisam nor innodb are able to handle the number of insters 
( 3 million lines in about 12 hours ) from so man different clients and 
crash the table.

Is there any other solution that keeps to one mysql connection?

Regards,
Samy

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Logging to a MySQL Database

Posted by Samuel Vogel <sa...@gmx.de>.
>> Hey guys,
>>
>> I am running Apache 2.2 and did try out mod_log_mysql to make my logs
>> to to an mysql table. Unfortunately I do run apache in prefork mode
>> and in peak times, there are arround 700 processes running.
>> The bad thing is that mod_log_mysql makes a new mysql connection for 
>> every single thread. This is not just causing a major mysql slowdown
>> but also neither myisam nor innodb are able to handle the number of
>> insters ( 3 million lines in about 12 hours ) from so man different
>> clients and crash the table.
>>     
>
> With prefork, 700 processes == 700 processes.  You've hit one of the
> scalability limitations of the prefork model.
>
> If you want to scale it, use a threaded MPM, and a logging module
> that takes advantage of connection pooling.  There's no standard
> module mod_log_dbd, but there might easily be a third-party one
> somewhere: it's a simple enough module to write if you have some
> time for it.
>   

As I do use PHP I can not just switch from prefork to worker.
My Problem is just with the logging, so I do not think a switch to a 
threaded apache would be required. At least I hope it is not!

On the other hand I can not find any up2date infos on how good php 
threading support has become. I do need all of gd-lib etc. to work.

Regards,
Samy

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Logging to a MySQL Database

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 31 Oct 2007 20:51:54 +0100
Samuel Vogel <sa...@gmx.de> wrote:

> Hey guys,
> 
> I am running Apache 2.2 and did try out mod_log_mysql to make my logs
> to to an mysql table. Unfortunately I do run apache in prefork mode
> and in peak times, there are arround 700 processes running.
> The bad thing is that mod_log_mysql makes a new mysql connection for 
> every single thread. This is not just causing a major mysql slowdown
> but also neither myisam nor innodb are able to handle the number of
> insters ( 3 million lines in about 12 hours ) from so man different
> clients and crash the table.

With prefork, 700 processes == 700 processes.  You've hit one of the
scalability limitations of the prefork model.

If you want to scale it, use a threaded MPM, and a logging module
that takes advantage of connection pooling.  There's no standard
module mod_log_dbd, but there might easily be a third-party one
somewhere: it's a simple enough module to write if you have some
time for it.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org