Welcome! Log In Create A New Profile

Advanced

http_dav_module fsync

Nagy, Attila
November 25, 2015 05:22AM
Hi,

I want to make sure that when nginx's DAV module responds with an OK for
a PUT (or COPY) request, the file is committed on disk.

I see the following solutions:
1. set the filesystem to be sync (for example zfs sync=always)
2. LD_PRELOAD a lib to nginx, which does an fsync before the close() call
3. introduce a dav_fsync on option
4. add a query parameter (or a header), which can be used to signal that
the client wants the file to be fsync()-ed

#1 is the worst performance wise, #2 is easy, but seems a little bit
hackish.

A quick glance to the source code tells me that implementing #3 could be
as easy to call an fsync() at the end of ngx_http_dav_put_handler(),
like this:

r->headers_out.status = status;
r->header_only = 1;

fsync(r->request_body->temp_file->file.fd);

ngx_http_finalize_request(r, ngx_http_send_header(r));
return;

Of course this blocks, which may badly hurt nginx performance.

What is your opinion on this? How this should be handled?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

http_dav_module fsync

Nagy, Attila November 25, 2015 05:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready