RkBlog

Hardware, programming and astronomy tutorials and reviews.

Plain Files - server I/O benchmarks

How reading plain files imact performance

5 files - 211,8KB in size

We use django and its default server and settings like in the main django/pylons benchmark. The view looks like this:
from django.shortcuts import render_to_response

def index(request):
	a = open('test/drive/a.html')
	aa = a.read()
	b = open('test/drive/b.html')
	bb = b.read()
	c = open('test/drive/c.html')
	cc = c.read()
	d = open('test/drive/d.html')
	dd = d.read()
	e = open('test/drive/e.html')
	ee = e.read()
	a.close()
	b.close()
	c.close()
	d.close()
	e.close()
	return render_to_response('index.html', {'var1': aa, 'var2': bb, 'var3': cc, 'var4': dd, 'var5': ee})
5 files which contains rubbish text. Now let us try httperf and see how much load it can take. For the ram test 50% of RAM (512MB Total) was mounted as test/drive/ and the files were copyed to that location. Mount command:
mount -t tmpfs tmpfs /path/to/mountpoint

RESULTS disk

Errors:
- 200 conns/s: 0 errors
- 300 conns/s: 17244 errors

Average connection time (ms):
200: 6.3
300: 1462.6

Reply time [ms]:
200: response 3.5 transfer 1.5
300: response 187.8 transfer 15.7

RESULTS RAM

Errors:
- 200 conns/s: 0 errors
- 300 conns/s: 17210 errors

Average connection time (ms):
200: 5.0
300: 1446.9

Reply time [ms]:
200: response 3.4 transfer 1.5
300: response 136.4 transfer 16.1

The RAM is bit faster (5.0 vs 6.3) when httperf gets some errors looking at other numbers is pointless.


SQLite test

This test was made using PHP/cgi 5.1.4 with bundled SQLite on a Cherokee server using a simple code in which we had: 10 inserts, 10 updates, 10 selects, 5 select *, 5 * select with LIKE and delete from at the end.
-
disk
RAM
Errors rate 20 / 100 conns
0
0
Errors rate 30 / 100 conns
2
0
Errors rate 40 / 100 conns
0
0
Errors rate 50 / 100 conns
31
0
Errors rate 60 / 100 conns
4
0
Errors rate 70 / 100 conns
6
0
-
-
-
Average connection time (ms) 20 / 100 conns
82.7
28.9
Average connection time (ms) 30 / 100 conns
1937.9
588.8
Average connection time (ms) 40 / 100 conns
1567.8
798.5
Average connection time (ms) 50 / 100 conns
1628.4
986.2
Average connection time (ms) 60 / 100 conns
1047.6
-
Average connection time (ms) 70 / 100 conns
1344,3
1511.5
-
-
-
Reply time response 20 / 100 conns
80.8
28.8
Reply time response 30 / 100 conns
1930.1
523.8
Reply time response 40 / 100 conns
1523.0
746.5
Reply time response 50 / 100 conns
3003.3
837.9
Reply time response 60 / 100 conns
2570.4
-
Reply time response 70 / 100 conns
2579.9
1232.7
-
-
-
Total CPU Time % 20 / 100 conns
38.6
42.9
Total CPU Time % 30 / 100 conns
42.8
39.1
Total CPU Time % 40 / 100 conns
41.9
21.8
Total CPU Time % 50 / 100 conns
50.8
1.8
Total CPU Time % 60 / 100 conns
42.3
-
Total CPU Time % 70 / 100 conns
32.7
1.2
The big difference between RAM and slow laptop disk was the disk activity. When SQLite file was on tmpfs the disk was silent and practicaly didn't do anyting. When the file was on disk - a lot of I/O operations were performed and on high load the system started to use SWAP.
RkBlog

14 July 2008;

Comment article