socket buffer size

24 views
Skip to first unread message

Guglielmo Fanini

unread,
Dec 2, 2019, 11:49:13 AM12/2/19
to mongodb-user

in lib mongo c driver would there be any benefit to increasing socket send/receive size with setsockopt SO_SNDBUF/SO_RCVBUF

that is assuming you don't send/receive huge single docs, but to somehow concatenate consecutive many write/reads to and from the mongo/s db ?

why nothing specified, I added it on the client side it doesn't seem to speed up much, is there any option for socket buffer size on client and server sides ?




Jeremy Mikola

unread,
Dec 9, 2019, 8:23:26 PM12/9/19
to mongodb-user
Cross-referencing this with your older thread on the subject, to which I also just replied: https://groups.google.com/d/msg/mongodb-user/rrr2_TIiHNo/_3QxO6dEBAAJ
I didn't find any discussions about customizing socket send/receive buffer sizes while searching old JIRA tickets. This subject also isn't discussed in the server manual for Operating System Configuration, which covers a number of other settings that can be customized for ensuring optimal performance.

libmongoc itself does not have any public-facing API for customizing buffer sizes for the sockets it creates. I don't think the mongoc_socket_setsockopt function applies, since sockets are not exposed in libmongoc's public API -- as I mentioned in my reply to your other thread, I believe that function is intended for use with libmongoc's streams API (primarily for wrapping drivers). I'm also not aware of any configuration option in the server for customizing these buffer sizes.

https://stackoverflow.com/a/56279407/162228 suggests that the kernel dynamically adjusts the size of buffers unless they are set to a fixed size with setsockopt(), so I would be inclined to rely on that behavior unless you have good reason to adjust it. Alternatively, you can also set default send/receive buffer sizes at the operating system level (to apply to all processes).
Reply all
Reply to author
Forward
0 new messages