8 Replies Last post: Jan 18, 2007 4:12 PM by jsegal  
Gaston Dombiak Jiver 3,771 posts since
Sep 26, 2001
Currently Being Moderated

Dec 19, 2006 3:18 PM

Finetuning for scalability summary

Hi,

 

As you may know we have been running load tests for the last 2 weeks. The numbers that we are getting are really awesome so I wanted to share with you some practices and optimizations we done in order to improve scalability of our next Wildfire version.

 

  • Out of the box DB connection pool has a min size of 5. This was the first bottleneck we found. The min and max size was set to 100.

  • Cache size is also a key factor to get good performance. A small cache size or low effectiveness implies more db queries. The main cache that we needed to increase was the Roster cache. To hold the roster of 25K users that contain 20 contacts each we needed a 48MB cache.

  • Offline timestamp is now stored in its own table (and uses a new Cache). Before it was being stored as a user property and it was a big bottleneck when users were coming online or offline.

  • Move as many db operations (INSERT, UPDATE) to run as batch processes. This will improve overall performance and reduce number of locks.

  • Use MINA to handle Connection Managers from Wildfire. MINA is a SEDA solution so overall performance will be greatly improved. MINA uses thread pools, queues and a Thread for sending packets.

  • MINA also supports a throttling filter that could be used to reduce incoming traffic when Wildfire has reached 100% of its capacity.

  • Optimized Cache#calculateSize to consider Strings and avoid serializing Strings to estimate their size.

  • Optimization: do not load User when not needed. In particular, do not validate if a user exists after it was successfully authenticated.

  • Optimization: avoid creating of DOM objects in CMs. Just pass the received Strings to Wildfire. This was a huge optimization.

  • Optimization: reduce number of parser instances in CMs. One per working thread instead of one per connection. This was a huge optimization.

  • Avoid reflection if possible. Reflection in Java is not that optimized. In particular, we replaced usage of reflection while executing a DB command with an IF statement.

 

Regards,

 

  -- Gato

Cohen Pascal Bronze 51 posts since
Aug 22, 2006
Currently Being Moderated
Dec 20, 2006 1:31 AM in response to: Gaston Dombiak
Re: Finetuning for scalability summary

Thanks for these great news Gato.

 

Now it''s time for us to try and see

LG KeyContributor 4,986 posts since
Dec 13, 2005
Currently Being Moderated
Dec 20, 2006 9:18 AM in response to: Gaston Dombiak
Re: Finetuning for scalability summary

Hi Gato,

 

* Out of the box DB connection pool has a min size of 5. This was the first bottleneck we found. The min and max size was set to 100. reminds me once again of the connection pool I did send you which is much faster than the one you are currently using.

Setting min and max to 100 is a bad idea as this may cause a high memory usage on the database server depending on the used database engine and settings.

 

* Offline timestamp is now stored in its own table (and uses a new Cache). Before it was being stored as a user property and it was a big bottleneck when users were coming online or offline. - This is just a small step to improve the database design.

 

LG

DeeJay Silver 365 posts since
Dec 9, 2006
Currently Being Moderated
Jan 7, 2007 7:40 AM in response to: LG
Re: Finetuning for scalability summary

You would assume that increasing the number of connections will increase memory utilisation on the database server.

 

Would it therefore be sensible to establish a ''rule of thumb'' for setting the value?

 

i.e. increase the concurrent connection count by 1 for every x number of users?

 

Many applications have a configuration value within the application to indicate the expected maximum number of concurrent users. Perhaps that could be added to wildfire (and other settings such as Java memory, max number of db connections etc could be automaticallky set based on that)?

LG KeyContributor 4,986 posts since
Dec 13, 2005
Currently Being Moderated
Jan 7, 2007 2:26 PM in response to: DeeJay
Re: Finetuning for scalability summary

Hi DeeJay,

 

the max. needed number of connections depends on a lot of factors like

authentication using Wildfires database vs. LDAP,

Enterprise Plugin and

MUC logging into the database,

the database caches Wildfire uses, ...

 

One should set the min. number of connections to 1 and the max. number to a value which can be handled by the database without problems, usually a value below 500 and monitor how many connections are used, add 10% and set this to the max. number.

 

LG

rage007   6 posts since
Aug 7, 2006
Currently Being Moderated
Dec 27, 2006 2:47 PM in response to: Gaston Dombiak
Re: Finetuning for scalability summary

Very interesting read on some of the finer points of Wildfire.

 

Thanks Gato!

Gustav Bertram   10 posts since
Jul 24, 2006
Currently Being Moderated
Jan 18, 2007 2:41 AM in response to: Gaston Dombiak
Re: Finetuning for scalability summary

Hi,

 

In the "scalability-turn-it-to-eleven" blog entry, Matiyam asked for the Tsung config you guys used.

 

Could you kindly provide it here?

 

Also, when can we expect these improvements to be released?

 

Regards,

Gustav

jsegal   40 posts since
Jun 28, 2006
Currently Being Moderated
Jan 18, 2007 4:12 PM in response to: Gustav Bertram
Re: Finetuning for scalability summary

If I recall from yesterday''s chat, Matt said the release date for 3.2, which would include these updates, is January 31.

 

Jeff

More Like This

  • Retrieving data ...