-
Notifications
You must be signed in to change notification settings - Fork 51
SocketOptions configuration is missing - Need to set tcp read/write buffer sizes #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ite buffer size from 32KB to 128 KB.
|
Linux test FAILed. |
|
Windows test FAILed. |
| HazelcastServer instance(*g_srvFactory); | ||
|
|
||
| ClientConfig clientConfig; | ||
| clientConfig.getNetworkConfig().getSocketOptions().setKeepAlive(false).setReuseAddress(true).setTcpNoDelay(false).setLingerSeconds(5).setBufferSize(2 * 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is tested here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not testing the functionality of each option but just a test to see that the client works when the options are set. This was mostly for coverage. More meaningful functionality tests would be better but I did not come up with a way how to test tcp level such settings yet.
| class HAZELCAST_API SocketOptions { | ||
| public: | ||
| /** | ||
| * constant for kilobyte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we dont need this comment, it doesnt say more than the variable name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are from Java client documentation. If needed we need to change both. I think it can stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they are not even used in Java :) I sent a cleanup PR for that https://github.com/hazelcast/hazelcast/pull/14147/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As they are part of API we cant change them I guess. If there isnt any check like checkstyle for CPP we shouldnt have them here. They are probably there in Java because of checkstyle(otherwise the build fails).
| static const int KILO_BYTE = 1024; | ||
|
|
||
| /** | ||
| * default buffer size of Bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int getLingerSeconds() const; | ||
|
|
||
| /** | ||
| * Enable/disable SO_LINGER with the specified linger time in seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What value disables SO_LINGER?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added doc:
*
* if set to a value of 0 or less then it is disabled.
*
* Default value is 3.
| SocketOptions &setLingerSeconds(int lingerSeconds); | ||
|
|
||
| /** | ||
| * Gets the SO_SNDBUF and SO_RCVBUF options to the specified value in KB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gets the SO_SNDBUF and SO_RCVBUF options value
| * Gets the SO_SNDBUF and SO_RCVBUF options to the specified value in KB | ||
| * @return bufferSize KB value | ||
| */ | ||
| int getBufferSize() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it returns in KB the name of the function can be getBufferSizeInKB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is actually bytes. Corrected the documentation now.
| * @param bufferSize KB value | ||
| * @return SocketOptions configured | ||
| */ | ||
| SocketOptions &setBufferSize(int bufferSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setBufferSizeInKB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is bytes. Changed doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is bytes I think method name should be setBufferSizeInBytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, changed.
| } | ||
|
|
||
| SocketInterface &TcpSocket::setSocketOptions(const client::config::SocketOptions &socketOptions) { | ||
| int optionValue = socketOptions.getBufferSize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for better readability instead of using optionValue we can use directly the option's name, for example here int bufferSizeInKB = socketOptions.getBufferSizeInKB()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named it this way to reuse the same local variable for each option instead of stack allocating a new one for each.
|
Linux test FAILed. |
|
Windows test FAILed. |
…xist at Linux. Also some review comment fixes.
47e26fb to
129103c
Compare
|
Windows test FAILed. |
|
Linux test FAILed. |
…uring SSL connect or after socket call for TcpSocket).
|
Windows test FAILed. |
|
Windows test FAILed. |
|
Linux test PASSed. |
|
Linux test PASSed. |
|
Windows test PASSed. |
|
Linux test PASSed. |
|
Windows test PASSed. |
|
Linux test PASSed. |
|
Linux test FAILed. |
|
Windows test FAILed. |
|
Linux test PASSed. |
|
Windows test PASSed. |
Added
SocketOptionsconfiguration and increased default tcp read/write buffer size from 32KB to 128 KB.fixes #465