AngersZhuuuu commented on pull request #30139: URL: https://github.com/apache/spark/pull/30139#issuecomment-717036010
> Sorry but your latest change doesn't actually lock properly. Long is immutable, and you always replace the object when you do the calculation and assign to the field, which is used as a lock. Your best try would be changing it to long (to avoid box/unbox), and have a separate Object field as locking purpose. Update and check **_1. with UT change_**  Current change With lock ``` OneForOneStreamManager fetch data duration test: Stream Size Max Min Avg 10000 2834 704 1188.0 50000 14048 10789 12055.7 ``` Only use AtomicLong ``` OneForOneStreamManager fetch data duration test: Stream Size Max Min Avg 10000 6723 724 1527.5 50000 14673 10712 12080.5 ``` **_2. Without UT change_** Current change With lock ``` OneForOneStreamManager fetch data duration test: Stream Size Max Min Avg 10000 822 176 360.1 50000 4190 1263 2387.9 100000 6785 3870 4811.9 ``` Only use AtomicLong ``` OneForOneStreamManager fetch data duration test: Stream Size Max Min Avg 10000 1037 167 548.5 50000 2982 1102 1712.8 100000 8779 3165 4831.9 ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
