mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-20 15:00:40 +00:00
feat: enable no delay for mysql, opentsdb, http (#2530)
* refactor: enable no delay for mysql, opentsdb, http * Apply suggestions from code review Co-authored-by: Yingwen <realevenyag@gmail.com> --------- Co-authored-by: Yingwen <realevenyag@gmail.com>
This commit is contained in:
@@ -728,7 +728,9 @@ impl Server for HttpServer {
|
||||
app = configurator.config_http(app);
|
||||
}
|
||||
let app = self.build(app);
|
||||
let server = axum::Server::bind(&listening).serve(app.into_make_service());
|
||||
let server = axum::Server::bind(&listening)
|
||||
.tcp_nodelay(true)
|
||||
.serve(app.into_make_service());
|
||||
|
||||
*shutdown_tx = Some(tx);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use auth::UserProviderRef;
|
||||
use common_runtime::Runtime;
|
||||
use common_telemetry::error;
|
||||
use common_telemetry::logging::{info, warn};
|
||||
use futures::StreamExt;
|
||||
use metrics::{decrement_gauge, increment_gauge};
|
||||
@@ -137,6 +138,9 @@ impl MysqlServer {
|
||||
match tcp_stream {
|
||||
Err(error) => warn!("Broken pipe: {}", error), // IoError doesn't impl ErrorExt.
|
||||
Ok(io_stream) => {
|
||||
if let Err(e) = io_stream.set_nodelay(true) {
|
||||
error!(e; "Failed to set TCP nodelay");
|
||||
}
|
||||
if let Err(error) =
|
||||
Self::handle(io_stream, io_runtime, spawn_ref, spawn_config).await
|
||||
{
|
||||
|
||||
@@ -81,6 +81,9 @@ impl OpentsdbServer {
|
||||
async move {
|
||||
match stream {
|
||||
Ok(stream) => {
|
||||
if let Err(e) = stream.set_nodelay(true) {
|
||||
error!(e; "Failed to set TCP nodelay");
|
||||
}
|
||||
let connection = Connection::new(stream);
|
||||
let mut handler = Handler::new(query_handler, connection, shutdown);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user