rouzier@gmail.com wrote:
Full_Name: James Rouzier Version: OS: URL: ftp://ftp.openldap.org/incoming/james-rouzier-150331.patch Submission from: (NULL) (192.222.129.11)
I am working on a proof of concept of a simple key value store service using lmdb as the back end. I am using sendfile to avoid an extra copy. I accomplished this by creating function to extract get the mmap ptr from the env so I can calculate the offset of data.
I'm quite reluctant to return the mmap pointer. In a WRITEMAP environment that invites all manner of undetectable/unpreventable corruptions.
Have you actually measured the performance difference between using sendfile() here and plain write() or send()? The kernel doesn't physically copy the written data from user space to kernel space, it just maps in a particular page. Since LMDB data is already mmap'd, the kernel has very little work to do since the relevant pages are already present in the kernel's page tables.
Ultimately sending data over TCP involves byte-by-byte iteration anyway, since TCP checksums must be computed on all outgoing data. Doesn't seem to me like sendfile can be a very significant optimization here.
I figured that function might be useful to the bigger community.
If it does not fit in the bigger vision of lmdb it is fine not to include it.
I, James Rouzier, hereby place the following modifications to OpenLDAP Software (and only these modifications) into the public domain. Hence, these modifications may be freely used and/or redistributed for any purpose with or without attribution and/or other notice.