We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I pressure tested pingora with wrk, I found that qps was low, general-purpose machines, and nginx was normal。
pub struct HttpEchoApp;
#[async_trait] impl ServeHttp for HttpEchoApp { async fn response(&self, http_stream: &mut ServerSession) -> Response<Vec> { // read timeout of 2s let read_timeout = 2000; let body = match timeout( Duration::from_millis(read_timeout), http_stream.read_request_body(), ) .await { Ok(res) => match res.unwrap() { Some(bytes) => bytes, None => Bytes::from("no body!"), }, Err(_) => { panic!("Timed out after {:?}ms", read_timeout); } };
Response::builder() .status(StatusCode::OK) .header(http::header::CONTENT_TYPE, "text/html") .header(http::header::CONTENT_LENGTH, body.len()) .body(body.to_vec()) .unwrap() }
}
pub fn new_http_echo_app() -> Arc { Arc::new(HttpEchoApp {}) }
pub fn echo_service_http() -> Service { Service::new("Echo Service HTTP".to_string(), new_http_echo_app()) }
fn main() { println!("ready to start server!!!!");
let mut my_server = Server::new(None).unwrap(); let mut sc = ServerConf{..Default::default()}; sc.threads = 4; my_server.configuration = Arc::new(sc); my_server.bootstrap(); let mut echo_service_http = echo_service_http(); echo_service_http.add_tcp("0.0.0.0:6145"); echo_service_http.add_uds("/tmp/echo.sock", None); my_server.add_service(echo_service_http); my_server.run_forever();
The text was updated successfully, but these errors were encountered:
--------------------------pingora------------------------------- [root@10 demo01]# wrk -t 4 -c 50 -d 30s http://127.0.0.1:6188 Running 30s test @ http://127.0.0.1:6188 4 threads and 50 connections Thread Stats Avg Stdev Max +/- Stdev Latency 63.57ms 249.95ms 1.94s 95.57% Req/Sec 1.09k 370.03 2.56k 71.35% 121194 requests in 30.11s, 225.26MB read Non-2xx or 3xx responses: 121194 Requests/sec: 4025.48
--------------------------nginx------------------------------- [root@10 demo01]# wrk -t 4 -c 50 -d 30s http://127.0.0.1:9080 Running 30s test @ http://127.0.0.1:9080 4 threads and 50 connections Thread Stats Avg Stdev Max +/- Stdev Latency 18.12ms 93.98ms 1.00s 96.49% Req/Sec 24.53k 15.85k 70.03k 68.82% 2768119 requests in 30.09s, 435.58MB read Requests/sec: 92006.88 Transfer/sec: 14.48MB
Sorry, something went wrong.
Non-2xx or 3xx responses: 121194
Pingora will close the connection if fail_to_proxy, please refer to #190
fail_to_proxy
I get it. Thx~
No branches or pull requests
Describe the bug
When I pressure tested pingora with wrk, I found that qps was low, general-purpose machines, and nginx was normal。
Pingora info
pub struct HttpEchoApp;
#[async_trait]
impl ServeHttp for HttpEchoApp {
async fn response(&self, http_stream: &mut ServerSession) -> Response<Vec> {
// read timeout of 2s
let read_timeout = 2000;
let body = match timeout(
Duration::from_millis(read_timeout),
http_stream.read_request_body(),
)
.await
{
Ok(res) => match res.unwrap() {
Some(bytes) => bytes,
None => Bytes::from("no body!"),
},
Err(_) => {
panic!("Timed out after {:?}ms", read_timeout);
}
};
}
pub fn new_http_echo_app() -> Arc {
Arc::new(HttpEchoApp {})
}
pub fn echo_service_http() -> Service {
Service::new("Echo Service HTTP".to_string(), new_http_echo_app())
}
fn main() {
println!("ready to start server!!!!");
}
The text was updated successfully, but these errors were encountered: