randy roy ha scritto: > When I first started with JAMES and MySQL, my mail load was pretty > light. So I just used the default MySQL configuration and the default > JAMES datasource configuration. Over the years, the amount of mail I'm > processing has grown significantly. It has come to the point where > MySQL is using 90-98% of the CPU, with the CPU pegged at 100% a lot of > the time.
First try this: mysql> repair table spool; mysql> repair table inbox; > So I started looking at some of the optional pre-canned config files > that come with MySQL. One is called my-huge.cnf. Seemed logical that I > have now grown into a need for an industrial strength config of MySQL. > So I tried reconfiguring MySQL to use the 'huge' config setup. > > The good news is that the CPU utilization went way down, implying that > MySQL is now running much more efficiently. The bad news is that after > running about 3-4 minutes with the new MySQL config, JAMES starts > throwing hundreds of "Connection Pool Exhausted" exceptions, and JAMES > grinds to a halt. > > So I had to back out the huge config for MySQL and now no more > connection pool exceptions. But the CPU is at 100% again. > > My question is, why would using the huge MySQL config cause JAMES to > start running out of connections? I played around with the max > connections field in the JAMES config. But it didn't seem to make any > difference. And I don't really want to just start setting super high > max values without knowing any criteria. But I really need to get MySQL > reconfigured someway to get it running more efficiently. > > Can somebody give me a quick recommendation on how to match the tuning > parameters between JAMES and MySQL? Is there some sort of formula to > setting connection parameters such that it works efficiently, yet > doesn't run out of connections? > > Thanks. I specify max, max_idle and max_wait to the pool (I don't remember the details, but I remember that the default configuration was easy to ran out of connections). <data-source name="maildb" class="org.apache.james.util.dbcp.JdbcDataSource"> <driver>com.mysql.jdbc.Driver</driver> <dburl>jdbc:mysql://127.0.0.1/james</dburl> <user>XXXX</user> <password>XXXXX</password> <max_idle>5</max_idle> <max>10</max> <max_wait>60000</max_wait> </data-source> Then you notice that there is a max 10: if you have more that 10 threads that concurrently will try to get a connection you will get an exception. So you should also make sure to not abuse spool threads and remote delivery threads. About spool threads: if you don't have asynchronous or slow matcher/mailets you probably don't need too much of them. I spool thousands of mails per minute with a couple of spool threads. Delivery threads are less "db" intensive so it is unlikely that you finish the connections because of them. The specific numbers depends on your configuration: start with small numbers and increase them only if you see specific behavior (slow spooling, slow delivery and so on) Stefano --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]