= Load Testing = [[TOC]] We recommend to use [http://tsung.erlang-projects.org Tsung] as a feature-rich & high-performing tool. The installation instructions for Tsung can be found here: [wiki:DeveloperGuidelines/Testing/Load/Setup Setup] Testing should normally be done from a separate machine. [InstallationGuidelines/Amazon Amazon] is great as a platform for accessing a lot 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 8,000 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.2.tar.gz tar zxvf tsung-1.4.2.tar.gz cd tsung-1.4.2 ./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() }}} Note how we read the _formkey from the form in order to be able to submit the data. {{{~/.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) === Previous Work === * [https://groups.google.com/forum/?fromgroups=#!searchin/sahana-eden/load$20tests/sahana-eden/k8wM1LfESH0/_V8EiiQnswgJ Discussion] on the mailing list. * Load tests being used previously - [https://github.com/somayjain/eden/commit/78127eac001452caeebe05fc20aa0d7ebb8cf3d0] ---- DeveloperGuidelines/Testing