It's not a secret anymore!*
The moose likes JForum and the fly likes JForum performance tuning for production Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "JForum performance tuning for production" Watch "JForum performance tuning for production" New topic
Author

JForum performance tuning for production

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Is there anything to take in consideration when using JForum for production ?

I mean are there settings for development and another for the production ?

Thank you

Hazem
[originally posted on jforum.net by haf@harf.com]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Nothing in specific. JForum2, by default, will only not work on clustered environments. To help on that - or even if you want more performance - you may want to take a look at http://www.terracotta.org/

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
We ran a performance test against JForum using a test tool called "Web performce trainer" with 500 users for 4 hours

After 100 users the response time dramatically increased to be hundreds of seconds for some actions like replying a topic or listing replies.

The java options we ran the test with is

-Xms2g -Xmx3g -XX:PermSize=256m -XX:+UseParallelGC -XX:+UseParallelOldGC -server -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

for a JBoss application server version 4.2.2 under Fedora 8 x86_64

After finishing run the test we opened the JForum url, then when we tried to login the following error ocurred
--------------------------------------------------------------
An error has occurred.

For detailed error information, please see the HTML source code, and contact the forum Administrator.

com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
--------------------------------------------------------------

We found also that JForum tells
--------------------------------------------------------------
" There are 7,014 online users: 212 registered, 6,802 guest(s) [ Administrator ] [ Moderator ]
Most users ever online was 15,735 on 18/05/2008 17:49:46 "
--------------------------------------------------------------

we did not invistigate the problem, it could be a simple configuration so we want to know what do you think about that.

[originally posted on jforum.net by haf@harf.com]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Well,

there is one thing which I have seen causing problems more than I would like, which is the number of topic views. Also, you may want to tune C3P0 (database connection pooling) as well.

For the first case, get the source code and comment all the code in src/net/jforum/dao/generic/GenericTopicDAO.java, method incrementTotalViews().

As of C3P0, the project page is http://sourceforge.net/projects/c3p0 (where you can find the documentation, or even take a look at some tutorials at Google). You can pass configuration arguments to the pool using the key "c3p0.extra.params" in SystemGlobals.properties.

One last thing: JForum holds all users in memory for session management, even anonymous users, and automatically removes them from memory after a period of inactivity, which is determined by the key "session-timeout" in web.xml, so each new session will be held in memory for at least 10 minutes (if session-timeout is 10) after his last activity in the forum (including browsing / reading).

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Also, make sure you set up some other connection pool options at WEB-INF/config/database/<dbname>/<dbname>.properties

(ps: which db are you using?)

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
A ResourcePool could not acquire a resource from its primary factory or source


Could this be caused by a connection leak somewhere ? Maybe there is a connection somewhere not closed in a finally block. Just a guess, I haven't reviewed the code.
[originally posted on jforum.net by ebourg]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
All code is executed inside a try-finally, so the connections are supposes to be returned.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael Steil wrote:Also, make sure you set up some other connection pool options at WEB-INF/config/database/<dbname>/<dbname>.properties

(ps: which db are you using?)

Rafael


I am using MySQL 5.0

i have commented the code in the method "incrementTotalViews" only, and i am going to restart the test to see its impact.
[originally posted on jforum.net by haf@harf.com]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hey, i found another thing,

i told you that i am using mysql version 5, i have restarted the application server (but not the database server which is located on a different machine), the tool couldn't connect to the mysql server reporting "too many connections" error.

i found the following page

http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html

it's telling


The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you need to support more connections, you should set a larger value for this variable.


and do you remember that i told you that the system performance dramatically degraded after 100 users ???

so there are some things to suspect, what do you think ?
[originally posted on jforum.net by haf@harf.com]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
If there are more concurrent connections than the database configuration support, the new incoming users will in fact be held until connections are returned to the connection pool, increasing the response time. Ideally, listings (forum, topic, posts) shouldn't take that long - well, post listing is very costly. C3P0 is one of the best connection pools out there, so it's worth to take a closer look at its configuration, to fine tune it. There is, of course, a possibility that JForum may be acting wrong somewhere (I'm not that kind of Developer that says that his software is perfect he he).

One of the first approaches that I usually do when this situations happen is to go smaller - test it with 50 concurrent users for a while, and see how things go, then increment to 75, then to 100, then to 110 (suggestion).

Terracotta is worth looking at as well, as they said performance increases dramatically using their approach.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
It seems to be something related to database and connection pool.

I increased maximum connectios for MySQL server up to 500 connections, then increased the C3P0 maximum connections to 450, and i left the test working yesterday, when i opened the JForum url today i found it giving me the following error




The C3P0 MBean tells that there are 450 connections exists.
[originally posted on jforum.net by haf@harf.com]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
By the way, I was monitoring the system CPU and memory via linux sar command during test.
and i attached the result

By the way the system response time for about 100 users is about 4 seconds (but the test was not for the 100 users, the users cout contninues to grow up to 500 causing troubles), which is good.
[originally posted on jforum.net by haf@harf.com]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JForum performance tuning for production
 
Similar Threads
jforum
WA #1.....word association
jforum and clusters
Search not limited to select forum
2.1.5 When ?