I have a RESTful web service (tornado), including login page, fetch data api, post data api and so on. To fetch or post data, the user need to login in advance. Now I want to test the performance of my service.
I just google it, and find that I can use Apache Bench
to test. something likeļ¼
> ab -n 100 -c 10 http://example.com
Now I can check the performance of login page, but how to login and test "fetch data api" through Apache Bench
Cookie
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
localhost FALSE / FALSE 1436347541 user "2|1:0|10:1433755541|4:user|4:IjEi|2906a3a418c013247ba2186dbba8f5134b20fc168063d952a3d5 6c1fbf167d63"
It depends on how your app authenticates users.
If it uses cookies, then the simplest way I can think of is to login to the website in any modern browser, open the browser's Dev Tools and look for the cookie that came back from the server.
Pass that cookie to Apache Benchmark using the
-C
option and have the url as the secure page that you want to test.