glance/glance/tests
Zhi Yan Liu 0711daa7c2 Resolving the performance issue for image listing of v2 API on server
This is a fix on Glance server side regarding to the former change
Ia6598d3c06a5ff516277053c2b6fa5db744fe9cf for glanceclient.

This change optimized the logic of image query in glance.db.ImageRepo
which running in glance-api server and communicated with glance-registry
service by HTTP based RPC calls. Under original logic, each image entry
in the (paginated) result set query RPC returned needs to query the
relevant tag entry set by a separated RPC again, so for example if we
have 1000 images, and page size equals 20, then the count of RPC calls
will be 1099 times. With fixed new logic, the RPC times have been
reduced, it merged the queries of image and its tag entry into one RPC
call.

As comparison [0], under the fixed new logic, the execution time of
image listing is about 2.5 times as fast as old logic (using
glanceclient cli with registry backend). Then the execution time of v2
api is better then v1 now[1] (about 2 times faster).

[0]
# Original logic

# glanceclient cli, with registry
$ time glance --os-image-api-version 2 image-list | grep 'test-' | wc -l
1000
real	0m10.210s
user	0m1.244s
sys	0m0.080s

# curl, with registry
$ time ./img1000-curl-v2.sh > /dev/null 2>&1
real	0m9.185s
user	0m0.168s
sys	0m0.108s

# Fixed logic

# glanceclient cli, with registry
$ time glance --os-image-api-version 2 image-list | grep 'test-' | wc -l
1000
real	0m3.870s
user	0m1.364s
sys	0m0.076s

# curl, with registry
$ time ./img1000-curl-v2.sh > /dev/null 2>&1
real	0m2.718s
user	0m0.160s
sys	0m0.136s

[1]
$ time glance --os-image-api-version 1 image-list | grep 'test-' | wc -l
1000
real	0m7.426s
user	0m0.936s
sys	0m0.100s

Change-Id: I3402e4594fa945d003a6735c54581fc43d07c6da
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
2014-07-09 22:26:52 +08:00
..
etc Remove user and key from location in swift 2014-06-24 12:13:26 +05:30
functional Resolving the performance issue for image listing of v2 API on server 2014-07-09 22:26:52 +08:00
integration Merge "Fix various Pep8 1.5.4 errors" 2014-05-20 15:11:05 +00:00
unit Merge "Remove unused methods" 2014-07-08 03:06:30 +00:00
var New -k/--insecure command line option 2012-02-13 13:57:13 +00:00
__init__.py Do not use __builtin__ in python3 2014-03-13 10:05:18 +08:00
stubs.py Remove vim header 2014-01-14 16:03:28 +00:00
test_hacking.py Add test for no_translate_debug_logs hacking check 2014-06-10 02:53:40 +00:00
utils.py replace dict.iteritems() with six.iteritems(dict) 2014-06-06 14:51:41 +00:00