Included system tests

Prebuilt packages and source tarball include scripts for measuring speed and for teseting correct system operation. Test are :

With prebuilt debian packages test are located in directory /usr/share/doc/php5-scache/tests.

Logic tests verify application functionality while iov-perf-test measures overall optimal speed.

Performance test

Performance test assumes both backend and test client to on same host and default to connect to localhost at address 127.0.0.1. If you want to test remote backend over network, please redefine constant TEST_HOST on top of the test script to point to remote host.

When testing against localhost, please keep in mind that most distributions define localhost with both IPv6 and IPv4 addresses while scached in it's default listen only IPv4 thus resulting connection failures.

localhost:~$ zcat /usr/share/doc/php5-scache/tests/iov-perf-test.php.gz | php5

Running scache_iov performance tests

Tests will be run until terminated by Ctrl+C.

If testing locally on multi processor machine, you should have
couple simultaneous iov-perf-test.phps running and combine
results.

If testing on a high latency environment (ie. over network)
you probably need plenty of iov-perf-test.phps running to
keep scached properly fed.

Expressed results are not cumulative.

Running... please wait:

....ok, 217484 ops/sec
....ok, 217975 ops/sec
....ok, 283850 ops/sec
....ok, 227417 ops/sec
....ok, 212379 ops/sec
....ok, 288093 ops/sec

Result above is from Intel Core2 Duo E8400/3Ghz with single running test instance only. If running on processor with multiple cores, you should run multiple instances of tests simultaneously and sum the averages of results to get actual maximum speed.

Because of network latencies cutting drastically throughput, if running tests over network you probably need very many querying instances to scached to get full 100% of cpu power.

Logic tests

Both logic tests are internally indentical except by logic-test-m using object interface API while logic-test using plain functional API.

Reference output from successful test :

localhost:~$ zcat /usr/share/doc/php5-scache/tests/logic-tests.php.gz | php5
dump_functions....
....enumerating defined functions
........scache_open
........scache_popen
........scache_reset
........scache_preset
........scache_connect
........scache_pconnect
........scache_connect_fast
........scache_pconnect_fast
........scache_rename
........scache_drop
........scache_getopt
........scache_setopt
........scache_status
........scache_srvstats
........scache_getindex
........scache_lasterr
........scache_strerror
........scache_iov
........scache_get
........scache_unset
........scache_stat
........scache_exists
........scache_set
........scache_add
........scache_replace
........scache_coll
........scache_shget
........scache_shunset
........scache_shstat
........scache_shexists
........scache_shset
........scache_shadd
........scache_shreplace
........scache_shcoll
........scache_chget
........scache_chput
........scache_chclear
........scache_vadd
........scache_vsub
........scache_vget
........scache_vset
........scache_vunset
........scache_rnpush
........scache_rnpop
........scache_rnshift
........scache_rnunshift
........scache_rnget
........scache_rnrotf
........scache_rnrotb
........scache_rnsize
........scache_rnclear
........scache_clear
........scache_shclear
........scache_vclear
connect_unix....
....ok
connect_ipv4....
....ok
connect_byname_localhost....
....ok
connect_persistent_index....
....persistent connections and index logic
....ok, passed
fast_connections....
....fast connections
....ok, passed
flood_connections....
....flooding 512 connections
....ok, passed
open_with_secret_key....
....scache_open with secret key
....ok, passed
session_status_result....
....connection round-trip with scache_status()
....ok, passed
large_session_tree....
....populating large session tree
........2000 sessions created
........4000 sessions created
........6000 sessions created
........8000 sessions created
........10000 sessions created
........12000 sessions created
........14000 sessions created
........16000 sessions created
........18000 sessions created
....ok, 18575.4 ops/sec
....verifying sessions
........2000 sessions verified
........4000 sessions verified
........6000 sessions verified
........8000 sessions verified
........10000 sessions verified
........12000 sessions verified
........14000 sessions verified
........16000 sessions verified
........18000 sessions verified
....ok, 54102.81 ops/sec
....dropping sessions
........2000 sessions dropped
........4000 sessions dropped
........6000 sessions dropped
........8000 sessions dropped
........10000 sessions dropped
........12000 sessions dropped
........14000 sessions dropped
........16000 sessions dropped
........18000 sessions dropped
....ok, 55844.31 ops/sec
getset_options....
....ok, get and set session expires
....ok, get and set keeponelimit
session_timeout....
....reset and populate with short timeout
....test immediate reconnection
....check value ok
....sleep 6 seconds and expect to be expired
....reconnect and assume expired
....expired, good
modifying_session_timeout....
....reset with 60 second timeout
....sleep 6 seconds and verify not expired
....session ok, modify timeout to 5 seconds
....sleep another 6 seconds and verify session expired
....ok, passed
session_renaming....
....setup first session
....start renaming
........10000 rounds
........20000 rounds
........30000 rounds
........40000 rounds
........50000 rounds
........60000 rounds
........70000 rounds
........80000 rounds
........90000 rounds
....ok, 62035.43 ops/sec
session_dropping....
....reset session and sanitycheck
....drop session
....re-open session with same name and check values does not exist
....ok, all passed
unsetting_values....
....unsetting values
........populating session
....ok, 26710.61 ops/sec
........next, unsetting values
....ok, 23712.52 ops/sec
........next, verifying they are gone
....ok, passed: 22071.43 ops/sec
collect_operations....
....basic operations
....keys matches
....binary keys
....subtype checking
....iov operations
wide_keyspace....
....store values (100000 rounds)
........10000 values stored
........20000 values stored
........30000 values stored
........40000 values stored
........50000 values stored
........60000 values stored
........70000 values stored
........80000 values stored
........90000 values stored
....ok, 24085.02 ops/sec
....next, read and check values
........10000 values read
........20000 values read
........30000 values read
........40000 values read
........50000 values read
........60000 values read
........70000 values read
........80000 values read
........90000 values read
....ok, passed: 22342.24 ops/sec
deep_tree....
....store values (20000 rounds)
........2000 values stored
........4000 values stored
........6000 values stored
........8000 values stored
........10000 values stored
........12000 values stored
........14000 values stored
........16000 values stored
........18000 values stored
....ok, 10777.01 ops/sec
....read and check values
........2000 values read
........4000 values read
........6000 values read
........8000 values read
........10000 values read
........12000 values read
........14000 values read
........16000 values read
........18000 values read
....ok, 18144.62 ops/sec
stat_paths....
....testing scache_stat -operation
....ok, passed
error_codes....
....session status
....rename unexistent session
....rename to existing
....drop unexistent session
....no session on set
....get unexisting
....add to existing
....replace unexistent
....unsetting unexisting
....vunset unexisting
....cache get without session
....cache put without session
....cache clear without session
....cache get unexisting
....getopt without session
random_access_flat....
....random storing and fetching on 1000 items wide keyspace
........10000 accesses
........20000 accesses
........30000 accesses
........40000 accesses
........50000 accesses
........60000 accesses
........70000 accesses
........80000 accesses
........90000 accesses
....ok, 18046.46 ops/sec, 50246 sets, 49754 clears
get_set_performance_unix....
....performance with single key over unix socket
........10000 rounds done
........20000 rounds done
........30000 rounds done
........40000 rounds done
........50000 rounds done
........60000 rounds done
........70000 rounds done
........80000 rounds done
........90000 rounds done
........100000 rounds done
....ok, passed: 11305.97 ops/sec
get_set_performance_localhost....
....performance with single key over connection to localhost 
........10000 rounds done
........20000 rounds done
........30000 rounds done
........40000 rounds done
........50000 rounds done
........60000 rounds done
........70000 rounds done
........80000 rounds done
........90000 rounds done
........100000 rounds done
....ok, passed: 11049.35 ops/sec
get_set_high_performance_iov_1key....
....populating session
....performance with 1 keys wide session using 20-op scache_iov
........50000 rounds done
........100000 rounds done
........150000 rounds done
........200000 rounds done
........250000 rounds done
........300000 rounds done
........350000 rounds done
........400000 rounds done
........450000 rounds done
........500000 rounds done
....ok, passed: 294105.55 ops/sec
get_set_high_performance_iov_100000key....
....populating session
....performance with 100000 keys wide session using 20-op scache_iov
........50000 rounds done
........100000 rounds done
........150000 rounds done
........200000 rounds done
........250000 rounds done
........300000 rounds done
........350000 rounds done
........400000 rounds done
........450000 rounds done
........500000 rounds done
....ok, passed: 224476.67 ops/sec
shared_counters....
....connect
....resetting counter
....incrementing counter
........value 5000
........value 10000
........value 15000
........value 20000
........value 25000
........value 30000
........value 35000
........value 40000
........value 45000
....ok, passed: 27550.47 ops/sec
....next, decrementing counter
........value 50000
........value 45000
........value 40000
........value 35000
........value 30000
........value 25000
........value 20000
........value 15000
........value 10000
........value 5000
....ok, passed: 28107.4 ops/sec
....next, setting and testing values
........value 5000
........value 10000
........value 15000
........value 20000
........value 25000
........value 30000
........value 35000
........value 40000
........value 45000
....ok, passed: 26652.78 ops/sec
set_add_replace_logic....
....value operations
....scache_set sets always
....scache_add adds if nonexistent
....scache_add does not replace
....scache_replace replaces only already existing
....scache_replace does not add values
....ok, passed
cache_features....
....basic cache functionality
........populating values
........verifing values
....stressing backends cache-ring, part 1
....stressing backends cache-ring, part 2
....verifying removed values
....subtree expiration
........expire by unput
........expire by put(false)
....complete expire from root
........10000 values populated
........20000 values populated
........30000 values populated
........40000 values populated
........50000 values populated
........60000 values populated
........70000 values populated
........80000 values populated
........90000 values populated
........expire from root
........verify
....ok, passed: 12351.35 ops/sec
....constant storing, constant expiring
........10000 values cached
........20000 values cached
........30000 values cached
........40000 values cached
........50000 values cached
........60000 values cached
........70000 values cached
........80000 values cached
........90000 values cached
....ok, passed: 25854.28 ops/sec
....random cache banging
........10000 values cached
........20000 values cached
........30000 values cached
........40000 values cached
........50000 values cached
........60000 values cached
........70000 values cached
........80000 values cached
........90000 values cached
....ok, passed: 18907.85 ops/sec
random_banging....
........round 10000
........round 20000
........round 30000
........round 40000
........round 50000
........round 60000
........round 70000
........round 80000
........round 90000
........round 100000
....ok, 27702.76 ops/sec
.... ops          : 203027
.... gets         : 7843
.... unsets       : 15651
.... newbranches  : 40896
.... newnodes     : 41045
.... descends     : 3889
.... maxdepth     : 89
....passed
io_multiplexing....
....allocating connections
....random access over connections
........round 10000
........round 20000
........round 30000
........round 40000
........round 50000
........round 60000
........round 70000
........round 80000
........round 90000
....ok, passed
scache_iov_swiss_army_knife....
....testing shared counters
....ok, testing session private operations
....ok, testing shared data operations
large_iov....
....ok, 100 iops, result matches
protocol_limits....
....uplimit key
....uplimit value
....memleak detect and pushing very large packets with iov
........1000 values pushed
........2000 values pushed
........3000 values pushed
........4000 values pushed
........5000 values pushed
........6000 values pushed
........7000 values pushed
........8000 values pushed
........9000 values pushed
....ok, 963.48 ops/sec
ring_basics....
....push values
....unshift values
....ring size
....rotate forward
....rotage backwards
....internal ordering
....pop/unshift
....remaining size
....clearing
....clearing unexistent
....getting, shifting, popping unexistent
singlecall_ring_stressing....
....populating ring
........10000 values pushed
........20000 values pushed
........30000 values pushed
........40000 values pushed
........50000 values pushed
........60000 values pushed
........70000 values pushed
........80000 values pushed
........90000 values pushed
....ok, 20087.18 ops/sec
....rotate and verify ring
........20000 rounds
........40000 rounds
........60000 rounds
........80000 rounds
........100000 rounds
........120000 rounds
........140000 rounds
........160000 rounds
........180000 rounds
....ok, 16160.6 ops/sec
....clearing ring
ring_stressing_with_iov....
....populating ring (10op iov)
........20000 values pushed
........40000 values pushed
........60000 values pushed
........80000 values pushed
........100000 values pushed
........120000 values pushed
........140000 values pushed
........160000 values pushed
........180000 values pushed
....ok, 148014.92 ops/sec
....purge ring (10op iov)
........20000 values shifted
........40000 values shifted
........60000 values shifted
........80000 values shifted
........100000 values shifted
........120000 values shifted
........140000 values shifted
........160000 values shifted
........180000 values shifted
....ok, 142639.09 ops/sec
....verify that ring is empty
....clearing ring
accumulator....
....ok
final_statistics....
....ok, statistics