diff --git a/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java b/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java index cff3ca28d73..99098b0472d 100644 --- a/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java +++ b/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java @@ -39,7 +39,7 @@ public static void main(String[] args) { // json ServletInfo jsonServletInfo = new ServletInfo(); jsonServletInfo.setServletName("json"); - jsonServletInfo.setServletClass(HelloWorldServlet.class.getName()); + jsonServletInfo.setServletClass(JsonServlet.class.getName()); jsonServletInfo.addMapping("/json"); applicationRuntime.getDeploymentInfo().addServlet(jsonServletInfo); containerRuntime.addRuntime(applicationRuntime); diff --git a/frameworks/PHP/ubiquity/benchmark_config.json b/frameworks/PHP/ubiquity/benchmark_config.json index 69e006ecb8c..52bb178e509 100644 --- a/frameworks/PHP/ubiquity/benchmark_config.json +++ b/frameworks/PHP/ubiquity/benchmark_config.json @@ -112,8 +112,7 @@ "database_os": "Linux", "display_name": "ubiquity-roadrunner", "notes": "", - "versus": "php", - "tags": ["broken"] + "versus": "php" }, "roadrunner-mysql": { "db_url": "/DbMy", @@ -134,8 +133,7 @@ "database_os": "Linux", "display_name": "ubiquity-roadrunner-mysql", "notes": "", - "versus": "php", - "tags": ["broken"] + "versus": "php" }, "workerman-mysql": { "db_url": "/DbMy", diff --git a/frameworks/PHP/ubiquity/ubiquity-roadrunner-mysql.dockerfile b/frameworks/PHP/ubiquity/ubiquity-roadrunner-mysql.dockerfile index 1f63ec96390..1ddb73d5a41 100644 --- a/frameworks/PHP/ubiquity/ubiquity-roadrunner-mysql.dockerfile +++ b/frameworks/PHP/ubiquity/ubiquity-roadrunner-mysql.dockerfile @@ -1,17 +1,17 @@ -FROM ubuntu:20.04 +FROM ubuntu:20.10 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php RUN apt-get update -yqq > /dev/null && \ - apt-get install -yqq php7.4 php7.4-common php7.4-cgi php-curl php7.4-mysql > /dev/null + apt-get install -yqq php8.0 php8.0-common php8.0-cgi php-curl php8.0-mysql > /dev/null RUN apt-get install -yqq composer > /dev/null RUN apt-get install -y php-pear php-dev > /dev/null -COPY deploy/conf/php-async.ini /etc/php/7.4/cgi/php.ini +COPY deploy/conf/php-async.ini /etc/php/8.0/cgi/php.ini ADD ./ /ubiquity WORKDIR /ubiquity @@ -37,7 +37,8 @@ RUN chmod 755 /bin/envwrapper.sh RUN chmod 777 -R /ubiquity/.ubiquity/* -#RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/7.4/cgi/php.ini +#RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/8.0/cgi/php.ini +RUN echo "opcache.jit_buffer_size=128M\nopcache.jit=tracing\n" >> /etc/php/8.0/cgi/php.ini COPY deploy/conf/roadrunner/mysql/rrServices.php app/config/rrServices.php diff --git a/frameworks/PHP/ubiquity/ubiquity-roadrunner.dockerfile b/frameworks/PHP/ubiquity/ubiquity-roadrunner.dockerfile index b7a2b010ec7..b2774faaf50 100644 --- a/frameworks/PHP/ubiquity/ubiquity-roadrunner.dockerfile +++ b/frameworks/PHP/ubiquity/ubiquity-roadrunner.dockerfile @@ -1,19 +1,19 @@ -FROM ubuntu:20.04 +FROM ubuntu:20.10 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php RUN apt-get update -yqq > /dev/null && \ - apt-get install -yqq php7.4 php7.4-common php7.4-cgi php7.4-pgsql php-curl > /dev/null + apt-get install -yqq php8.0 php8.0-common php8.0-cgi php8.0-pgsql php-curl > /dev/null RUN apt-get install -yqq composer > /dev/null RUN apt-get install -y php-pear php-dev > /dev/null -COPY deploy/conf/php-async.ini /etc/php/7.4/cgi/php.ini +COPY deploy/conf/php-async.ini /etc/php/8.0/cgi/php.ini ADD ./ /ubiquity WORKDIR /ubiquity @@ -39,7 +39,8 @@ RUN chmod 755 /bin/envwrapper.sh RUN chmod 777 -R /ubiquity/.ubiquity/* -#RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/7.4/cgi/php.ini +#RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/8.0/cgi/php.ini +RUN echo "opcache.jit_buffer_size=128M\nopcache.jit=function\n" >> /etc/php/8.0/cgi/php.ini COPY deploy/conf/roadrunner/pgsql/rrServices.php app/config/rrServices.php diff --git a/frameworks/Rust/ntex/Cargo.toml b/frameworks/Rust/ntex/Cargo.toml index fac22df8593..c6bc5455c22 100755 --- a/frameworks/Rust/ntex/Cargo.toml +++ b/frameworks/Rust/ntex/Cargo.toml @@ -15,13 +15,10 @@ path = "src/main_db.rs" name = "ntex-raw" path = "src/main_raw.rs" -[[bin]] -name = "ntex-sailfish" -path = "src/main_sailfish.rs" - [dependencies] -ntex = "0.2.0-b.5" -mimalloc = { version = "0.1.21", default-features = false } +ntex = "0.2.0-b.9" +mimalloc = { version = "0.1.22", default-features = false } +snmalloc-rs = { version = "0.2.23", features = ["1mib", "native-cpu"] } yarte = { version = "0.14", features = ["bytes-buf", "json"] } env_logger = "0.8" random-fast-rng = "0.1.1" @@ -37,7 +34,6 @@ serde = { version = "1.0", features = ["derive"] } log = { version = "0.4", features = ["release_max_level_off"] } tokio = "=0.2.6" tokio-postgres = { git="https://github.com/fafhrd91/postgres.git" } -sailfish = "0.3.0" [profile.release] lto = true diff --git a/frameworks/Rust/ntex/benchmark_config.json b/frameworks/Rust/ntex/benchmark_config.json index 0b978158b4f..86888acc90b 100755 --- a/frameworks/Rust/ntex/benchmark_config.json +++ b/frameworks/Rust/ntex/benchmark_config.json @@ -39,23 +39,6 @@ "notes": "", "versus": "" }, - "sailfish": { - "fortune_url": "/fortunes", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "ntex", - "language": "Rust", - "orm": "Raw", - "platform": "None", - "webserver": "ntex", - "os": "Linux", - "database_os": "Linux", - "display_name": "ntex [sailfish]", - "notes": "", - "versus": "" - }, "raw": { "json_url": "/json", "plaintext_url": "/plaintext", diff --git a/frameworks/Rust/ntex/config.toml b/frameworks/Rust/ntex/config.toml index e4013c950c4..25c8933555f 100644 --- a/frameworks/Rust/ntex/config.toml +++ b/frameworks/Rust/ntex/config.toml @@ -14,18 +14,6 @@ platform = "None" webserver = "ntex" versus = "" -[sailfish] -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "ntex" -versus = "" - [db] urls.db = "/db" urls.query = "/query?q=" diff --git a/frameworks/Rust/ntex/ntex-sailfish.dockerfile b/frameworks/Rust/ntex/ntex-sailfish.dockerfile deleted file mode 100644 index 099c4ac0a10..00000000000 --- a/frameworks/Rust/ntex/ntex-sailfish.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.49 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /ntex -WORKDIR /ntex - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release - -EXPOSE 8080 - -CMD ./target/release/ntex-sailfish diff --git a/frameworks/Rust/ntex/src/db.rs b/frameworks/Rust/ntex/src/db.rs index 6fee9d59320..a90bc60ae69 100644 --- a/frameworks/Rust/ntex/src/db.rs +++ b/frameworks/Rust/ntex/src/db.rs @@ -1,7 +1,4 @@ -use std::borrow::Cow; -use std::cell::RefCell; -use std::fmt::Write as FmtWrite; -use std::io; +use std::{borrow::Cow, cell::RefCell, fmt::Write as FmtWrite, io}; use bytes::{Bytes, BytesMut}; use futures::stream::futures_unordered::FuturesUnordered; @@ -13,7 +10,7 @@ use tokio_postgres::types::ToSql; use tokio_postgres::{connect, Client, NoTls, Statement}; use yarte::{ywrite_html, Serialize}; -#[derive(Serialize, Debug)] +#[derive(Copy, Clone, Serialize, Debug)] pub struct World { pub id: i32, pub randomnumber: i32, @@ -154,10 +151,10 @@ impl PgConnection { for w in &worlds { params.push(&w.id); } - - cl.query(&st, ¶ms) + let _ = cl + .query(&st, ¶ms) .await - .map_err(|e| io::Error::new(io::ErrorKind::Other, format!("{:?}", e)))?; + .map_err(|e| log::error!("{:?}", e)); Ok(worlds) } diff --git a/frameworks/Rust/ntex/src/main_raw.rs b/frameworks/Rust/ntex/src/main_raw.rs index 31ad41a2010..c08baa490b0 100644 --- a/frameworks/Rust/ntex/src/main_raw.rs +++ b/frameworks/Rust/ntex/src/main_raw.rs @@ -72,7 +72,7 @@ impl Future for App { } } if updated { - this.state.dsp_flush_write_data(cx.waker()); + this.state.dsp_restart_write_task(); } if !this.state.is_read_ready() { this.state.dsp_read_more_data(cx.waker()); diff --git a/frameworks/Rust/ntex/src/main_sailfish.rs b/frameworks/Rust/ntex/src/main_sailfish.rs deleted file mode 100644 index 1067e7c0f61..00000000000 --- a/frameworks/Rust/ntex/src/main_sailfish.rs +++ /dev/null @@ -1,151 +0,0 @@ -#[global_allocator] -static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - -use std::borrow::Cow; -use std::future::Future; -use std::io; -use std::pin::Pin; -use std::task::{Context, Poll}; - -use bytes::Bytes; -use futures::future::{ok, FutureExt}; -use futures::stream::StreamExt; -use ntex::http::body::Body; -use ntex::http::header::{HeaderValue, CONTENT_TYPE, SERVER}; -use ntex::http::{HttpService, KeepAlive, Request, Response, StatusCode}; -use ntex::service::{Service, ServiceFactory}; -use ntex::web::Error; -use sailfish::TemplateOnce; -use smallvec::{smallvec, SmallVec}; -use tokio_postgres::{connect, Client, NoTls, Statement}; - -struct Fortune { - id: i32, - message: Cow<'static, str>, -} - -#[derive(TemplateOnce)] -#[template(path = "fortune.stpl", rm_whitespace = true)] -struct Fortunes { - items: SmallVec<[Fortune; 32]>, -} - -struct App { - hdr_srv: HeaderValue, - hdr_cthtml: HeaderValue, - db: Client, - fortune: Statement, -} - -impl Service for App { - type Request = Request; - type Response = Response; - type Error = Error; - type Future = Pin>>>; - - #[inline] - fn poll_ready(&self, _: &mut Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } - - fn call(&self, req: Request) -> Self::Future { - let path = req.path(); - match path { - "/fortunes" => { - let h_srv = self.hdr_srv.clone(); - let h_ct = self.hdr_cthtml.clone(); - let fut = self.db.query_raw(&self.fortune, &[]); - - Box::pin(async move { - let mut stream = fut.await.map_err(|e| { - io::Error::new(io::ErrorKind::Other, format!("{:?}", e)) - })?; - - let mut items: SmallVec<[_; 32]> = smallvec![Fortune { - id: 0, - message: Cow::Borrowed( - "Additional fortune added at request time." - ), - }]; - - while let Some(row) = stream.next().await { - let row = row.map_err(|e| { - io::Error::new(io::ErrorKind::Other, format!("{:?}", e)) - })?; - items.push(Fortune { - id: row.get(0), - message: Cow::Owned(row.get(1)), - }); - } - - items.sort_by(|it, next| it.message.cmp(&next.message)); - - let body = match (Fortunes { items }).render_once() { - Ok(body) => Ok(Bytes::from(body)), - Err(e) => { - Err(io::Error::new(io::ErrorKind::Other, e.to_string())) - } - }?; - - let mut res = Response::with_body(StatusCode::OK, Body::Bytes(body)); - let hdrs = res.headers_mut(); - hdrs.insert(SERVER, h_srv); - hdrs.insert(CONTENT_TYPE, h_ct); - Ok(res) - }) - } - _ => Box::pin(ok(Response::new(http::StatusCode::NOT_FOUND))), - } - } -} - -#[derive(Clone)] -struct AppFactory; - -impl ServiceFactory for AppFactory { - type Config = (); - type Request = Request; - type Response = Response; - type Error = Error; - type Service = App; - type InitError = (); - type Future = Pin>>>; - - fn new_service(&self, _: ()) -> Self::Future { - const DB_URL: &str = - "postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world"; - - Box::pin(async move { - let (db, conn) = connect(DB_URL, NoTls) - .await - .expect("can not connect to postgresql"); - ntex::rt::spawn(conn.map(|_| ())); - - let fortune = db.prepare("SELECT * FROM fortune").await.unwrap(); - - Ok(App { - hdr_srv: HeaderValue::from_static("N"), - hdr_cthtml: HeaderValue::from_static("text/html; charset=utf-8"), - db, - fortune, - }) - }) - } -} - -#[ntex::main] -async fn main() -> std::io::Result<()> { - println!("Starting http server: 127.0.0.1:8080"); - - ntex::server::build() - .backlog(1024) - .bind("techempower", "0.0.0.0:8080", || { - HttpService::build() - .keep_alive(KeepAlive::Os) - .client_timeout(0) - .h1(AppFactory) - .tcp() - })? - .start() - .await -}