-
Notifications
You must be signed in to change notification settings - Fork 967
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
[IOTDB-1257] Make a little bit improvement of config and fix some bugs for setting logic #2904
Conversation
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.
LGTM
Thanks for the review @ericpai ! And I would like to make a little bit improvement later(Improvement of configuration items in IoTDBConfig & Config & RpcUtils). then would be great if you have time to review the update:) Thank you! |
…s for setting logic
I would like to review this PR myself first and looking forward the CI results. |
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.
Looks good to me.
By the way, I tested this branch on the MacOS of version 10.15.7 and all the test cases passed. So I doubts about the test case of DataClientProviderTest.testSyncConcurrency, it may be some fixes to be done.
Thanks for your feedback! @irvine0109 ! I had run the test in local and rerun the CI check, then the test case of testSyncConcurrency has passed. @qiaojialin @jixuan1989 @jt2594838 would be great to have your comments in this PR. :) |
The only concern from me is the default_buffer size is set as 16MB while it was 64KB.
|
as service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java is modified, I asked @neuyilan to have a review. |
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.
Thanks for your efforts.
But I have the same concerning problems with @jixuan1989, why we change the default thrift initial buffer size 64KB to 16MB?
There are some requests only need minor thrift buffer sizes, such as heartbeat, match term request, request commit id when syncing leader, and so on. if we change the default size to 16MB, it may be wast some memory. As far as I know, thrift declares a 16MB memory array at initialization (if the initial size is set to 16MB).
In fact, according to our previous experience, only when a snapshot occurs, the request will be larger than 16MB, because a single raft log cannot be larger than 16MB (WAL buffer size is only 8MB by default, if it is larger than 16MB, an error will be reported). If multiple raft logs exceed 16MB, we have split them into batches and sent them.
Thanks for the feedback @jixuan1989 @neuyilan Before this PR, every small request will be expanded to 16m (I guess Jialin's thinking at that time was to avoid frequent expansion caused by the default value of 64K, and expand to 16m at one time), the resize logic is here . but the default 16m will also involve frequent capacity reduction, when frequent (5 times +) small requests comings. Therefore, setting the default values of 64K and 16m is a simple trade-off, because the memory consumption will be dynamically adjusted according to the request size and I appreciate if you can share some thoughts here @qiaojialin :) |
Hi, I'm coming...
That's right. This is due to that in TElasticFramedTransport, The following code is only for the shrink. However, the resizeIfNecessary() method could expand if the request size < 16m. if (size < softMaxLength) { Setting the initial value to 16m is better than the current design. Another way is to split the resizeIfNecessary() to expandIfNecessary() and shrinkIfNecessary(). Then: if (size < softMaxLength) { |
This is the essence of the problem. When the current thrift size is less than softMaxLength, calling this function will expand the thrift size to softMaxLength. We only need to separate the expand and shrink methods. |
If there's any misunderstanding,I'm very glad to receive any feedbacks and details about the design :) |
` ` |
…ome bugs for setting logic
…ome bugs for setting logic
Thank you all for the feedback and discussion. At present, we have basically reached an agreement. Based on our discussion, The resizeifnecessary maintains the encapsulation shrinkage strategy and is transparent to the caller,and we set the default value to 64KB. We can continue to discuss better contraction strategies, and better improvements can be made by opening separate PR. What do you think @neuyilan :) |
Hi, @sunjincheng121 I think this idea is OK. |
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.
LGTM
SonarCloud Quality Gate failed. |
Thank you all! Merging... |
Change logs:
RpcTransportFactory.setMaxLength(ioTDBConfig.getThriftMaxFrameSize());
. i.e.,Don't putmax_frame_ Size
assoftmaxlength
.initialBufferCapacity
andmaxFrameSize
tothriftDefaultBufferSize
. andthriftDefaultBufferSize
configable by user.initial_buffer_capacity
tothrift_default_buffer_capacity
max_frame_size
tothrift_max_frame_size
RpcUtils.java
in the service-rpc module depends on tsfile & thrift moudlesConfig.java
in the iotdb-jdbc module depends on service-rpc & others moudlesIoTDBConfig.java
in the iotdb-server module depends on service-rpc & iotdb-jdbc moudlesSo, such as
initial_buffer_Capacity
andMax_frame_size
config items should be based on rpcutilsRpcUtils.java
.There is an open question about #3 & #4. Do we need to modify the variable name, which will affect the compatibility? What do you think?