The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security and Performance FAQs
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Mon Jul 28, 2008 9:19 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 20, 2008 10:38 pm
Posts: 6
Hi

I've not long implemented a Joomla 1.5 site. At the start it seemed great, no problems, nice and quick. Then after a while it got to be slow - at some points painfully slow, even to the point of timing out. I've therefore been an avid reader of these forums to try to work out what's going wrong.

As a result, I've played with various extensions, installing, uninstalling, activating and deactivating, and nothing really helps that much. I've enabled caching, globally, for modules and at plugin level. This has done something but not much. I've now asked my host to enable the slow log query to see if I can turn up what the problem is.

I then came across the MYSQL "Explain" command, and the "Debug mode" in Joomla. I switched on the debug mode, loaded up my homepage, and took the queries (there were 17) into SQL one by one and ran them through the EXPLAIN query. I was expecting one of the extensions to be the problem, but it looks to me like two queries relating to table jos_session are actually causing the slowness. Have I uncovered a fault with session handling in 1.5.4? Here are the results from the EXPLAIN query:

Code:
EXPLAIN DELETE FROM jos_session WHERE (

time < '1217270705'
)

MySQL said: 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELETE
  FROM jos_session
  WHERE ( time < '1217270705' )' at line 1


Code:
EXPLAIN UPDATE `jos_session` SET `time` = '1217274305',
`userid` = '0',
`usertype` = '',
`username` = '',
`gid` = '0',
`guest` = '1',
`client_id` = '0',
`data` = '__default|a:7:{s:15:\"session.counter\";i:3;s:19:\"session.timer.start\";i:1217274124;s:18:\"session.timer.last\";i:1217274238;s:17:\"session.timer.now\";i:1217274278;s:22:\"session.client.browser\";s:89:\"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\";s:8:\"registry\";O:9:\"JRegistry\":3:{s:17:\"_defaultNameSpace\";s:7:\"session\";s:9:\"_registry\";a:1:{s:7:\"session\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}}s:7:\"_errors\";a:0:{}}s:4:\"user\";O:5:\"JUser\":19:{s:2:\"id\";i:0;s:4:\"name\";N;s:8:\"username\";N;s:5:\"email\";N;s:8:\"password\";N;s:14:\"password_clear\";s:0:\"\";s:8:\"usertype\";N;s:5:\"block\";N;s:9:\"sendEmail\";i:0;s:3:\"gid\";i:0;s:12:\"registerDate\";N;s:13:\"lastvisitDate\";N;s:10:\"activation\";N;s:6:\"params\";N;s:3:\"aid\";i:0;s:5:\"guest\";i:1;s:7:\"_params\";O:10:\"JParameter\":7:{s:4:\"_raw\";s:0:\"\";s:4:\"_xml\";N;s:9:\"_elements\";a:0:{}s:12:\"_elementPath\";a:1:{i:0;s:97:\"/hsphere/local/home/icpadmin/immanuelchurchpenarth.org.uk/libraries/joomla/html/parameter/element\";}s:17:\"_defaultNameSpace\";s:8:\"_default\";s:9:\"_registry\";a:1:{s:8:\"_default\";a:1:{s:4:\"data\";O:8:\"stdClass\":0:{}}}s:7:\"_errors\";a:0:{}}s:9:\"_errorMsg\";N;s:7:\"_errors\";a:0:{}}}' WHERE session_id = '526161f0e43933e49685a8b4976c98be'

MySQL said: 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE `jos_session`
  SET `time`='1217274305',`userid`='0',`usertype`='',`use' at line 1


I have to say that I'm not a programmer - I'm actually a part-time lawyer, part-time minister! So in terms of technical skills I'm not that hot. But what I have noticed is that these queries appear on nearly every post where someone complains of slowness, it's just because they are seen to be "normal" and part of the core, they're never raised as issues.

My site is still slow (http://www.immanuelchurch.org.uk), so it would be wonderful if someone who really knows what they're talking about could have a look at this and see if the problem could be resolved. Thanks v. much!


Top
 Profile  
 
PostPosted: Tue Jul 29, 2008 3:35 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 20, 2008 10:38 pm
Posts: 6
OK, I've found something of a solution to this. Here's what I did:

1. Changed the Session Handler in Global Configuration from "Database" to "None". As far as I can see, that means that the jos_session table isn't used to control user sessions.

2. Asked my web host to kill any troublesome queries on the Joomla database (that is, any that are taking a very long time to run).

3. Ran table repair for the jos_session table in myssql.

The results are that my site now runs fine whether caching is enabled or not, and it flies when caching is switched on. So far this has been a complete fix, though I am slightly concerned about the potential security tradeoff, and would prefer if I could use database session control; but at the moment that's just out of the question.

Is this something the Joomla! Development team are aware of?


Top
 Profile  
 
PostPosted: Tue Jul 29, 2008 4:41 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Nov 10, 2005 3:10 am
Posts: 1926
Location: New Jersey, USA
What you are experiencing is due to an improperly setup/tuned mysql server. Using php for session handing (none) is fine, but there are some drawbacks compared to letting MySQL handle it. In general, I would say this is not a Joomla core issue (since I've seen the DB session handling handle quite a few simultaneous sessions... Somewhere around 5k simultaneous sessions)...

_________________
Anthony Ferrara - Core Team - Development Coordinator - Bug Squad - JSST

http://moovum.com/ - The Bird is in the air! Get Mollom Anti-Spam on your Joomla! website with Moovur...
http://www.joomlaperformance.com For All Your Joomla Performance Needs


Top
 Profile  
 
PostPosted: Tue Jul 29, 2008 5:17 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 20, 2008 10:38 pm
Posts: 6
Thanks for the response, Maxwell. Two questions arise, then:

1. Could you point me in the direction of what needs to be tuned on the mysql server? As I've said, the difference I've experienced isn't small numbers; it's the difference between 2 seconds to load and 50 seconds to load, or sometimes timing out.

2. I'm confused as to why running those queries through EXPLAIN should cause them to generate errors. I guess in testing those queries don't produce errors, so I've done something odd with my database at some point?? Could installing, then uninstalling Community Builder have caused this?

Thanks for your help.


Top
 Profile  
 
PostPosted: Tue Jul 29, 2008 6:19 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Thu Nov 10, 2005 3:10 am
Posts: 1926
Location: New Jersey, USA
legal steve wrote:
Thanks for the response, Maxwell. Two questions arise, then:

1. Could you point me in the direction of what needs to be tuned on the mysql server? As I've said, the difference I've experienced isn't small numbers; it's the difference between 2 seconds to load and 50 seconds to load, or sometimes timing out.

2. I'm confused as to why running those queries through EXPLAIN should cause them to generate errors. I guess in testing those queries don't produce errors, so I've done something odd with my database at some point?? Could installing, then uninstalling Community Builder have caused this?

Thanks for your help.

1. Google it, there's a ton of stuff out there on tuning MySQL... But, the timeouts and such are due to lock contention on the table. Are you on a dedicated server? How are you planning on tuning MySQL if you don't have root access (or do you)?

2. You can only run SELECT statements through EXPLAIN. Update and Delete don't work.

_________________
Anthony Ferrara - Core Team - Development Coordinator - Bug Squad - JSST

http://moovum.com/ - The Bird is in the air! Get Mollom Anti-Spam on your Joomla! website with Moovur...
http://www.joomlaperformance.com For All Your Joomla Performance Needs


Top
 Profile  
 
PostPosted: Tue Jul 29, 2008 10:35 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 20, 2008 10:38 pm
Posts: 6
Ok, thanks for both these responses. That gives me something I can speak to my host about.

Thanks.


Top
 Profile  
 
PostPosted: Mon Dec 01, 2008 8:50 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Sep 28, 2008 10:37 am
Posts: 5
Thank you for this topic and discussion.

I have problem with a Joomla installation using Virtuemart. I have 5000 products, and want to add more, but my site has become a bit sluggish. It is noticably small and very frustrating. I am also using sh404SEF URLs which doesn't help speed at all.

But, after reading this thread I turned the Session Handler to None, and it did speed things up a small amount. I guess with all my DB queries I should also get into speeding up MySQL, but this thread was a good starting point.

Thanks


Top
 Profile  
 
PostPosted: Fri May 15, 2009 8:20 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Thu Nov 03, 2005 12:10 am
Posts: 573
Location: Hesperia, California, USA
ircmaxell wrote:
What you are experiencing is due to an improperly setup/tuned mysql server. Using php for session handing (none) is fine, but there are some drawbacks compared to letting MySQL handle it. In general, I would say this is not a Joomla core issue (since I've seen the DB session handling handle quite a few simultaneous sessions... Somewhere around 5k simultaneous sessions)...


IRCMaxell: Thanks for the excellent information. Which is the optimal method of handling chaching, database or non (php)? What specifically are the drawbacks?

_________________
http://www.DIRTFORGE.com - WEB | PHOTO | WRITE | MARKETING | DESIGN
http://www.LiveOnDIRT.com - Live Extreme Action Sports Lifestyle Show


Top
 Profile  
 
PostPosted: Thu Aug 05, 2010 4:44 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Sep 13, 2007 3:20 pm
Posts: 59
Sorry for resurrecting an old thread but I thought this deserved a little more attention.

I run a fairly large community site using community builder and have several extra components and modules installed. The site has around 125,000 registered members and does around 16,000 page loads per day. After upgrading the site from 1.0 to 1.5 and moving to a more powerful box I noticed at peak times that the site becomes very sluggish and slow, I use memcache, phpaccelerator, an optimizer that combines, compresses, and minifies java and css, and run a quad core dedicated box with 8gb of ram. Looking at the server stats and running a top command in ssh showed that the cpu was getting maxed out to extremely dangerous levels, in fact a times it was going to over 50, when on a quad core the most it should ever go is 4! Of course the thing that was driving the heavy load was mysql.

First things first, since it was a new box I of course needed to tweak the my.cnf to optimize mysql. This helped quite a bit once I got the mysql settings dialed in correctly, but the site was still too sluggish for my taste and even though the cpu usually ran at around 1 it would spike at times to over 4. Further research into what was causing such a heavy load on mysql showed the session handling to be the root of all evil. Letting the database handle the sessions seems like the best idea in theory, but with the load it was putting on the database it just didn't make sense.

I'm not sure why using memcache as the session handler is even an option as I don't know of anyone that has a functioning live site using it. But, as mentioned above by legal steve, when I switched the session handler to none to take the load off of mysql I saw an INCREDIBLE jump in performance. Response time on page load jumped from over 9 seconds using yslow to under 3, and the cpu load was dramatically reduced.

I think that anyone trying to optimize the speed of their Joomla site (and that should really include every single person that runs a site) should take a look at their session handler.


Top
 Profile  
 
PostPosted: Mon Mar 19, 2012 12:30 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sat Nov 21, 2009 3:11 pm
Posts: 132
What is the downside of changing the session handler to "None"?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 



Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group