[[TOC]] = Load Testing = We recommend to use [http://tsung.erlang-projects.org Tsung] as a feature-rich & high-performing tool. Testing should normally be done from a separate machine. [InstallationGuidelines/Amazon Amazon] is great as a platform for accessing a lof of resources for a short period of time. * A 'Micro' instance is sufficient for testing 100 concurrent users (the dynamic parts of the site) * A 'High CPU' instance is required for testing 6,500 concurrent users (the static parts of the site) == Server Setup == Tsung can include results on Server Load if SNMP is enabled: {{{ apt-get install -y snmpd vim /etc/snmp/snmpd.conf #agentAddress udp:127.0.0.1:161 agentAddress udp:161,udp6:[::1]:161 #rocommunity public default -V systemonly rocommunity public 0.0.0.0/0 /etc/init.d/snmpd restart }}} Notes: * Log files can fill-up quickly, especially when testing a large number of users for the static parts of the site * Database will need resetting to clear any transactions made * Reboot between tests to reset the RAM/Swap == Client Setup == === Installation === {{{ apt-get install -y erlang gnuplot libtemplate-perl make lrzsz vim wget http://tsung.erlang-projects.org/dist/tsung-1.4.1.tar.gz tar zxvf tsung-1.4.1.tar.gz cd tsung-1.4.1 ./configure make make install ssh localhost yes to accept hostkey exit }}} === Static Tests === It is recommended to make the homepage of the site static. The performance of this page can be tested using an 8-way CPU ('High CPU' on Amazon). * This requires the system to be able to SSH to itself {{{~/.tsung/tsung.xml}}}: {{{ }}} === Dynamic Tests === A set of transactions can be performed with an increasing level of load. Content can be pulled from CSV if it needs to vary per run (e.g. usernames to register). Can create a large CSV using a simple Python script: {{{ #!/usr/bin/env python FILENAME = "users.csv" f = open(FILENAME, "wb") for i in range(1, 100000): f.write("Test%i%40example.com\n" % i) f.close() }}} {{{~/.tsung/tsung.xml}}}: {{{ }}} === Run Tests === (replace 20xxx with the name of the folder created) {{{ tsung start cd ~/.tsung/log/20xxx /usr/lib/tsung/bin/tsung_stats.pl cd .. tar cvf 20xxx.tar 20xxx/ gzip -9 20xxx.tar sz 20xxx.tar.gz rm -rf 20xxx* }}} === Analyse Results === Open report.html in a web browser: * Check that there are minimal errors * Check the Response time (Request is per-request, Transaction is for the whole script) ---- DeveloperGuidelinesTesting