<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 29, 2012, at 23:19 , Thomas Goirand wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>On 02/29/2012 05:47 PM, Robert Krig wrote:<br><blockquote type="cite">I don't know if its gonna cause problems if MySQL has so many threads<br></blockquote><blockquote type="cite">open.<br></blockquote><br>It is *not* a problem. Just make sure that the max_connection directive<br>in your MySQL server is set to a high number. The default (100<br>connections) really is too low, and should be increased to something<br>like 500 or 1000. My experience shows that 500 MySQL connections isn't<br>an issue anyway.<br></div></blockquote><div><br></div><div>MySQL does handle large # of connections very well in my experience.</div><div>Basically the architecture of mod_log_sql is to open and maintain one connection per apache preforked process. &nbsp;So, if you have a lot of traffic going on *now* you'll have a lot of preforked apache processes, thus a large # of mysql connections. &nbsp; If you have apache configured to have a large number of idle processes waiting for new traffic, then yes you'll encounter a large number of idle mysql connections.</div><div><br></div><div>There are a few other options if it is becoming a problem.</div><div><br></div><div>Use the mod_dbd support driver and a threaded apache MPM. &nbsp;Assuming your application can run in a threaded apache MPM (Worker or event) you can make use of the mod_dbd connection pooling and reduce your connections. &nbsp;This in *theory* should be thread safe due to mod_dbd's architecture. It's been a while since I write it, but I was pretty certain that I added mod_dbd support for a client who wanted to run in threaded mode and use connection pooling.</div><div><br></div><div>Another option is to use the force preserve option, and import the preserve files at a regular interval. &nbsp;You do lose some "real-timeness" of the data, but it will reduce connection load to the server.</div><div><br></div><div>Like the preserve option, you can use the "cli utility" to import raw apache access logs in. (only available in the latest git master, not in a released version). &nbsp;This was another client request. &nbsp;They moved to an infrastructure that didn't allow for direct db connections (Amazon Cloud), so they wanted a CLI script that would parse the apache logs into the mod_log_sql db format. &nbsp; The latest git code also includes a more powerful configuration syntax to allow better customizing of the db format.</div></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Edward Rudd</div><div>OutOfOrder.cc</div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></body></html>