lhotari commented on code in PR #24766:
URL: https://github.com/apache/pulsar/pull/24766#discussion_r2363271555


##########
pip/pip-443.md:
##########
@@ -0,0 +1,233 @@
+# PIP-443: Stop using Netty Recycler in new code
+
+# Background knowledge
+
+Netty 
[`Recycler`](https://github.com/netty/netty/blob/netty-4.1.127.Final/common/src/main/java/io/netty/util/Recycler.java)
 is widely used in many places to reduce GC pressure by reusing objects. From 
the outputs of the following command:
+
+```bash
+find . -name "*.java" | grep src/main | xargs grep -n "new .*Recycler"
+```
+
+You can find:
+- 5 usages in `pulsar-common`
+- 10 usages in `pulsar-broker`
+- 10 usages in `pulsar-client`
+
+However, it's a pre-mature optimization without any real world evidence. Many 
of them are only the result of cargo cult programming. Hence, we should 
understand how it works first.

Review Comment:
   It most likely was useful to some extent when it was introduced a long time 
ago. :) Java JVMs have developed a lot over the last 10+ years. Generational 
ZGC is pretty amazing and makes it unnecessary to use object recycling.
   (Generational ZGC blog posts: [by 
Netflix](https://netflixtechblog.com/bending-pause-times-to-your-will-with-generational-zgc-256629c9386b),
 [by Gunnar 
Morling](https://www.morling.dev/blog/lower-java-tail-latencies-with-zgc/))
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to