mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
debug: introduce support for configuring client connect WRITE deadline (#19170)
just like client-conn-read-deadline, added a new flag that does client-conn-write-deadline as well. Both are not configured by default, since we do not yet know what is the right value. Allow this to be configurable if needed.
This commit is contained in:
@@ -393,6 +393,7 @@ func buildServerCtxt(ctx *cli.Context, ctxt *serverCtxt) (err error) {
|
||||
ctxt.ConnReadDeadline = ctx.Duration("conn-read-deadline")
|
||||
ctxt.ConnWriteDeadline = ctx.Duration("conn-write-deadline")
|
||||
ctxt.ConnClientReadDeadline = ctx.Duration("conn-client-read-deadline")
|
||||
ctxt.ConnClientWriteDeadline = ctx.Duration("conn-client-write-deadline")
|
||||
|
||||
ctxt.ShutdownTimeout = ctx.Duration("shutdown-timeout")
|
||||
ctxt.IdleTimeout = ctx.Duration("idle-timeout")
|
||||
|
||||
@@ -160,10 +160,11 @@ type serverCtxt struct {
|
||||
FTP []string
|
||||
SFTP []string
|
||||
|
||||
UserTimeout time.Duration
|
||||
ConnReadDeadline time.Duration
|
||||
ConnWriteDeadline time.Duration
|
||||
ConnClientReadDeadline time.Duration
|
||||
UserTimeout time.Duration
|
||||
ConnReadDeadline time.Duration
|
||||
ConnWriteDeadline time.Duration
|
||||
ConnClientReadDeadline time.Duration
|
||||
ConnClientWriteDeadline time.Duration
|
||||
|
||||
ShutdownTimeout time.Duration
|
||||
IdleTimeout time.Duration
|
||||
|
||||
@@ -296,27 +296,23 @@ func collectAPIStats(api string, f http.HandlerFunc) http.HandlerFunc {
|
||||
|
||||
bucket, _ := path2BucketObject(resource)
|
||||
|
||||
globalHTTPStats.currentS3Requests.Inc(api)
|
||||
defer globalHTTPStats.currentS3Requests.Dec(api)
|
||||
|
||||
_, err = globalBucketMetadataSys.Get(bucket) // check if this bucket exists.
|
||||
if bucket != "" && bucket != minioReservedBucket && err == nil {
|
||||
countBktStat := bucket != "" && bucket != minioReservedBucket && err == nil
|
||||
if countBktStat {
|
||||
globalBucketHTTPStats.updateHTTPStats(bucket, api, nil)
|
||||
}
|
||||
|
||||
globalHTTPStats.currentS3Requests.Inc(api)
|
||||
f.ServeHTTP(w, r)
|
||||
globalHTTPStats.currentS3Requests.Dec(api)
|
||||
|
||||
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
tc, _ := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
||||
if tc != nil {
|
||||
globalHTTPStats.updateStats(api, tc.ResponseRecorder)
|
||||
globalConnStats.incS3InputBytes(int64(tc.RequestRecorder.Size()))
|
||||
globalConnStats.incS3OutputBytes(int64(tc.ResponseRecorder.Size()))
|
||||
|
||||
if bucket != "" && bucket != minioReservedBucket && err == nil {
|
||||
if countBktStat {
|
||||
globalBucketConnStats.incS3InputBytes(bucket, int64(tc.RequestRecorder.Size()))
|
||||
globalBucketConnStats.incS3OutputBytes(bucket, int64(tc.ResponseRecorder.Size()))
|
||||
globalBucketHTTPStats.updateHTTPStats(bucket, api, tc.ResponseRecorder)
|
||||
|
||||
@@ -106,6 +106,12 @@ var ServerFlags = []cli.Flag{
|
||||
Hidden: true,
|
||||
EnvVar: "MINIO_CONN_CLIENT_READ_DEADLINE",
|
||||
},
|
||||
cli.DurationFlag{
|
||||
Name: "conn-client-write-deadline",
|
||||
Usage: "custom connection WRITE deadline for outgoing requests",
|
||||
Hidden: true,
|
||||
EnvVar: "MINIO_CONN_CLIENT_WRITE_DEADLINE",
|
||||
},
|
||||
cli.DurationFlag{
|
||||
Name: "conn-read-deadline",
|
||||
Usage: "custom connection READ deadline",
|
||||
@@ -356,9 +362,10 @@ func serverHandleCmdArgs(ctxt serverCtxt) {
|
||||
})
|
||||
|
||||
globalTCPOptions = xhttp.TCPOptions{
|
||||
UserTimeout: int(ctxt.UserTimeout.Milliseconds()),
|
||||
ClientReadTimeout: ctxt.ConnClientReadDeadline,
|
||||
Interface: ctxt.Interface,
|
||||
UserTimeout: int(ctxt.UserTimeout.Milliseconds()),
|
||||
ClientReadTimeout: ctxt.ConnClientReadDeadline,
|
||||
ClientWriteTimeout: ctxt.ConnClientWriteDeadline,
|
||||
Interface: ctxt.Interface,
|
||||
}
|
||||
|
||||
// On macOS, if a process already listens on LOCALIPADDR:PORT, net.Listen() falls back
|
||||
|
||||
Reference in New Issue
Block a user