Closed nnao45 closed 5 years ago
sure, you can try. Could you test 1.0-rc version? 0.7 is in maintenance mode
@fafhrd91 thank you for reply.
Could you test 1.0-rc version?
Okay, Done. But...I look like slow... do you think?
OS: Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
Platform: GCP, GCE
Machine Type: n1-standard-4(vCPU: 4, Memory, 15G)
Rust Version: cargo 1.36.0-nightly (759b6161a 2019-05-06)
[package]
name = "basics"
version = "1.0.0"
authors = ["nnao45 <n4sekai5y@gmail.com>"]
workspace = ".."
edition = "2018"
[dependencies]
actix-rt = "0.2"
actix-web = "1.0.0-rc"
futures = "0.1.25"
env_logger = "0.5"
bytes = "0.4"
#[macro_use]
extern crate actix_web;
use std::{env, io};
use actix_web::http::{header, Method, StatusCode};
use actix_web::{
error, guard, middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer,
Result,
};
use bytes::Bytes;
use futures::unsync::mpsc;
use futures::{future::ok, Future, Stream};
#[get("/hc")]
fn hc() -> Result<HttpResponse> {
Ok(HttpResponse::build(StatusCode::OK)
.content_type("plain/text; charset=utf-8")
.body(Bytes::from(&b"OK"[..])))
}
fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "actix_web=debug");
env_logger::init();
let sys = actix_rt::System::new("basic-example");
HttpServer::new(|| {
App::new()
// enable logger
.wrap(middleware::Logger::default())
.service(hc)
})
.bind("10.146.0.5:8787")?
.start();
sys.run()
}
siege -c 100 -r 1000 --benchmark http://10.146.0.5:8787/hc
[alert] Zip encoding disabled; siege requires zlib support to enable it
** SIEGE 4.0.2
** Preparing 100 concurrent users for battle.
The server is now under siege...
Transactions: 100000 hits
Availability: 100.00 %
Elapsed time: 88.43 secs
Data transferred: 0.19 MB
Response time: 0.09 secs
Transaction rate: 1130.84 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 97.15
Successful transactions: 100000
Failed transactions: 0
Longest transaction: 0.98
Shortest transaction: 0.00
expected numbers for console logging
Hi. I use actix, and I write code is too slow when using logging middleware Should I fix this?
platform
OS: Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux Platform: GCP, GCE Machine Type: n1-standard-4(vCPU: 4, Memory, 15G) Rust Version: cargo 1.36.0-nightly (759b6161a 2019-05-06)
nouse middleware
use middleware