archiecobbs / s3backer

FUSE/NBD single file backing store via Amazon S3
Other
535 stars 77 forks source link

too many time_wait socket when writing to a newly created disk #199

Closed VVoidV closed 1 year ago

VVoidV commented 1 year ago

I got some log below when I write to a newly created disk. But when I overwrite some file, everything is fine.

Nov 22 11:33:26 ecm-b0d3 nbdkit[29425]: s3backer: operation failed: Couldn't connect to server (will retry)
Nov 22 11:33:56 ecm-b0d3 nbdkit[29425]: s3backer: operation failed: Couldn't connect to server (will retry)
Nov 22 11:34:28 ecm-b0d3 nbdkit[29425]: s3backer: operation failed: Couldn't connect to server (will retry)
Nov 22 11:35:01 ecm-b0d3 nbdkit[29425]: s3backer: operation failed: Couldn't connect to server (will retry)

I found it will use a lot of short link when writing to brand new block. There will be 24000 time_wait tcp sockets. I think we shoud reuse curl handle when we get 404 with GET request.

I also did some experiment, when I reuse curl handle by this way, the problem goes away and the perf increase. image

I am not familiar to libcurl, can we reuse the handle on http server return some error status?

archiecobbs commented 1 year ago

Good idea - thanks. Should be fixed in 2c837c3.