We use Livezilla on our site and have for some time. It’s a great tool, with a free version available to boot. However, we did end up tracing a rather significant site performance issue back to the software. We weren’t going to let the 1-2 second delay our users were suffering keep us from our favorite live chat software, so we set out to solve the problem once and for all.
After some debugging, we discovered that the cause is the loading of some Javascript and a callback to the server.
So, we decided to try to modify the code so that the Livezilla Javascript loads after the rest of the page has finished loading. Voila, the delay is gone!
Here’s how we did it:
First an example of the “Before” API code (only the relevant part).
<!— LiveZilla Tracking Code (ALWAYS PLACE IN BODY ELEMENT) —>
[removed]
var script = document.createElement(“script”);
script.type=”text/javascript”;
var src = “http://www.presto-changeo.com/livezilla/server.php?request=track&output=jcrpt&nse;=”+Math.random();
setTimeout(“script.src=src;document.getElementById(‘livezilla_tracking’).appendChild(script)”,1);[removed]
<!— http://www.LiveZilla.net Tracking Code —>
And here is the “After” version:
<!— LiveZilla Tracking Code (ALWAYS PLACE IN BODY ELEMENT) —>
[removed]
var script = document.createElement(“script”);
script.type=”text/javascript”;
var src = “http://www.presto-changeo.com/livezilla/server.php?request=track&output=jcrpt&nse;=”+Math.random();
$(document).ready(function (){setTimeout(“script.src=src;document.getElementById(‘livezilla_tracking’).appendChild(script)”,1);});
[removed]<!— http://www.LiveZilla.net Tracking Code —>
Note: If you apply this fix to a. tpl file directly, add {literal}{/literal} tags around the code.
There are a couple of other things to look out for when it comes to Livezilla and site performance.
First, we were using a VPS at one point and received a usage warning because of Livezilla. It seems that by default, Livezilla is set to refresh the connection list every 4 seconds, I recommend changing it to 15+ seconds. Just go to Server Configuration > Server and find the Client Poll Frequency setting.
Lastly, our site began running extremely slowly one day and the database was not responding well. After some investigation, we found around 20+ Livezilla queries trying to run, and Mysql using over 300% CPU.
It turned out that due to some, how shall we say, not so efficient queries and database indexes that Livezilla uses, almost 500K rows of data had been written to the following tables: visitor_browsers and visitor_browser_urls.
Naturally we emptied those tables, and everything went back to normal.
We highly recommend doing the same, probably about once a month. You can do so by running the following command on your livezilla database
TRUNCATE `visitor_browsers`;
TRUNCATE `visitor_browsers_url`;
Tweet