Posts Tagged ‘performance’

Installing Zenoss Core on OpenVZ and Ubuntu-VEs

Monday, December 26th, 2011

What is Zenoss Core?

Zenoss Core is a fabulous, Open Source, network and device monitor. It allows you to collect statistics, track uptime and get alerts for a wide array of devices and applications, i.e. printers, routers, Linux and Windows servers, Varnish cache and many more.

It is important to see the performance of your digital assets, to ensure optimum experience for the users, and be able to react before someone notices the problems on the outside of your organisation.

Mission-critical components, i.e. corporate e-mail servers can be monitored with this solution.

Setting up Zenoss Core on an Ubuntu-VPS under OpenVZ

OpenVZ can be installed in a OpenVZ container. I chose to use the contributed Ubuntu 10.04 minimal template downloaded from OpenVZ.org. It will be a dedicated VE, just for Zenoss Core.

"ubuntu-10.04-minimal_10.04_amd64.tar.gz"

  • 10.04 is LTS (long term supported)
  • the minimal comes without Apache or other services

The installation of the Zenoss stack will fail if your resource limits (particularly memory) are set too low. Here's an excerpt from the configuration file of my VPS:

ONBOOT="yes"

# UBC parameters (in form of barrier:limit)
KMEMSIZE="14372700:14790164"
LOCKEDPAGES="256:256"
PRIVVMPAGES="1175000:1250000"
SHMPAGES="21504:21504"
NUMPROC="240:240"
PHYSPAGES="0:9223372036854775807"
VMGUARPAGES="33792:9223372036854775807"
OOMGUARPAGES="26112:9223372036854775807"
NUMTCPSOCK="360:360"
NUMFLOCK="188:206"
NUMPTY="16:16"
NUMSIGINFO="256:256"
TCPSNDBUF="1720320:2703360"
TCPRCVBUF="2703360:3003360"
OTHERSOCKBUF="1126080:2097152"
DGRAMRCVBUF="262144:262144"
NUMOTHERSOCK="360:360"
DCACHESIZE="3409920:3624960"
NUMFILE="9312:9312"
AVNUMPROC="180:180"
NUMIPTENT="128:128"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="5242880:5242880"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair sheduler parameter
CPUUNITS="1000"

You need to install wget and binutils.

apt-get install wget binutils

Then download the newest Zenoss Stack DEB package from Zenoss. The stack includes webserver, a dedicated MySQL instance and other things for running Zenoss. Choose from the native stacks (DEBIAN/UBUNTU), DEB based. In /tmp :

wget http://dev.zenoss.org/deb/dists/main/stable/binary-amd64/zenoss-stack_3.2.1_x64.deb

I used the x64 stack, as we have a 64bit server.

Install the stack using dpkg:

dpkg -i zenoss-stack_3.2.1_x64.deb

This will take quite some time! On finish, start Zenoss Core with

/etc/init.d/zenoss-stack start

Now you are finished with the console part. Fire up your browser, and go to the installation server's IP, port 8080. I.e. http://www.example.com:8080.

Here you will be asked to setup the admin password and a new user for "everyday usage". After creating them, you will be given the opportunity to automatically discover devices and servers, to manually set them up, or to skip to the dashboard. (You can, of course, always add devices and servers later on).

After getting to the dashboard, you can set up a Google Maps API Key. That is pretty self-explanatory, Zenoss Core will help you do it.

Good luck!

Further reading / watching:

Zenoss installation & monitoring a Linux server with SNMP

More information about this screencast on Castix – also includes the example snmpd.conf mentioned in the screencast.

Zenoss Core Getting Started – Adding Devices

Links

Compiling with ruby and closure

Tuesday, November 1st, 2011

Here's some code to call closure (which is renamed closure.jar) from a ruby script:

def optimize_js(target)
#get all files in this folder, recurse over them
filecounter = 0
modifiedcounter = 0
Dir.glob(target + '*.js').each do|f|
puts "Processing #{f}"
filecounter += 1
my_js = `java -jar closure.jar –charset iso-8859-1 –js #{f}`
File.open(f, "w"){|con_file|
con_file.write(my_js)
}
end

puts "\n\t # JS Optimization: Done. Modified #{filecounter} files."
end

This code will overwrite the js files, so please be sure to operate on a copy of your files!

It is a function which takes a directory (target) and processes all files with the ending .js, replacing them in place with the optimized JS output. You need to put closure.jar in the same directory as the ruby script.

Note, that I also use the –charset iso-8859-1 option. This option ensures that closure reads the file in that iso charset, instead of assuming UTF-8. UTF-8 as default will work ok, until you have special characters from foreign languages, i.e. ä ö ü ß or á or whatever. Think Spanisch, French, German.

GWAN – the fastest webserver in the world?

Tuesday, November 30th, 2010

Sometimes you keep wondering, why really big companies still roll with PHP. Facebook, for instance, created a PHP to C++ Crosscompiler to allow more connections handled per server. Why not start out in C immediately?

G-WAN claims to be the fastest webserver in the world. It is not open source, and it's creator has some fantastic claims – i.e. G-WAN being 5.000.000 (that's right, 5 million) times faster than Microsoft IIS under certain circumstances.

As of now, there is a mention in Wikipedia but no full entry. Information seems to be very sparse on the Internet, most pages offering a download of the software.

Anyways, it's got some very interesting features which make it worthwile to have a look at:

  • configuration is done exclusively through folder structure (!)
  • small size, freeware
  • one threaded model vs. Apaches one thread for each connection
  • C scripts for content generation

The main downside is it being closed source. This is bad, because you are not able to review the source code for "phoning home", and if the developer decides to discontinue the product, no one else would be able to continue it.

As to the other downside claimed by some (using C instead of PHP): A reason for companies going the PHP route is the easy availability of a lot of pre-existing code libraries. You just have to build on top of this software to create your product. Sometimes it's easy to take an existing product and extend it (which is easily done having the source as it is mostly the case with PHP based software…). G-WAN could fit into the niche of delivering static content or generating images – taking the load off your PHP/ASP/… frontend step by step. And maybe some time you'll find yourself going the C route.

Here are some more links:


Seiten beschleunigen

Tuesday, March 9th, 2010

Bereits beim Entwickeln der Seite ist es angenehmer, wenn der Server schneller reagiert.

Diese Yahoo! Seite hat mehr Informationen über Seitenbeschleunigung.

Interessante Tools werden ebenfalls angeboten:

  • YSlow – ein Firefox Plugin was ermittelt WARUM die Seite langsam ist
  • Smush.it™ – verkleinert Bilder verlustfrei!

Um möglichst viele Elemente in dem BrowserCache vorzuhalten, sollte man die Expires Headers richtig setzen.

Dieser Artikel gibt eine kurze Anleitung für Apache & mod_rewrite.

Ich benutze z.B. folgendes in meiner .htaccess:

#Speed UP!
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 years"
ExpiresByType text/html "access plus 30 seconds"
</IfModule>

Natürlich muss man dazu sicherstellen dass mod_expires installiert ist. Unter Debian:

ls -l /etc/apache2/mods-enabled/

Unter Debian hat man auch bequeme Tools um Module zu aktivieren und zu deaktivieren (einfach aufrufen, sie bieten die entsprechenden Module an):

a2enmod – Modul aktivieren
a2dismod – Modul deaktivieren

Weitere Optimierungsmöglichkeiten bestehen im Einsatz von Kompression – mod_deflate, Reduktion der eingebundenen Dateien (ganz wichtig!) und natürlich dem Einsatz eines CDNs – eines Content Delivery Networks. Wir empfehlen MaxCDN (das erste Terabyte für 10$!) bzw. NetDNA.

Ein netter Nebeneffekt der meisten dieser Optimierungen ist die Reduktion der Last auf den Server – was wiederum zu höherer Performance bei vielen Besuchen führt!!

Auf Wunsch optimieren wir Ihre Seite hinsichtlich der beschriebenen Prinzipien um die optimale Geschwindigkeit für Sie und Ihre Besucher herauszuholen. Nehmen Sie mit uns jetzt Kontakt auf!