Skip to content

no response when I used wrk to test the server based on cpprest #849

Open
@winstard

Description

I changed the source code of CasaLens(the sample project) like this:

 void CasaLens::handle_get(http_request message)
{    
	static std::mutex mutex;
	message.reply(web::http::status_codes::OK);
	std::lock_guard<std::mutex>` `lock(mutex);
	static int b = 0;
	std::wcout << "b " << b++ << std::endl;
	return;
}

Then I used wrk to test the performance
wrk -c 1500 -t 10 -d 1m --timeout=30s http://10.22.99.13:12344

the result was:

Running 1m test @ http://10.22.99.13:12344
  10 threads and 1500 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.24s   284.07ms   1.42s    86.96%
    Req/Sec    13.17     14.51    42.00     83.33%
  23 requests in 1.00m, 2.38KB read
  Socket errors: connect 489, read 169, write 0, timeout 0
Requests/sec:      0.38
Transfer/sec:      40.57B

It just printed

b 1
b 2
...
b 1033

on the consle of the CasaLens.
And there was no response when I hit Enter in the consle.

I tried to debug the cpprest. Found that it can't callback after called HttpReceiveHttpRequest at void windows_request_context::async_process_request(HTTP_REQUEST_ID request_id, http_request msg, const unsigned long headers_size),when wrk has been executed for a while.
And no response after listener.close().wait();

The same question when I try to use cpprest to create a restful service on Linux.
Is my usage or something else wrong?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions