Refer previous article @ https://querydb.blogspot.com/2023/11/hbase-performance-optimization-page3.html
This article is more about optimizing API ( Rest/ SOAP Web service) build on top of HBase.
- We had Spring Boot application deployed in docker container. On further analysis, we found that -
- Our Spring Boot version was 2.0.4.RELEASE, which by default has Tomcat 8.5.32 and HTTPCore 4.4.10
- There was reported bug regarding same which leads to many TCP connections in CLOSE_WAIT status, which eventually makes API unresponsive.
- Refer -
- Solution -
- Upgrade Spring Boot version to 2.7.17 as that is last release in 2.x releases, compatible with Java 8, and includes httpcore v4.4.16 and tomcat v9.0.82
- There were too many HTTP connections to API leading to Connection TimedOut & Connection Refused error.
- Solution -
- increase tomcat threads by setting - server.tomcat.max-threads=400 . By default this is set to 200
- We noticed that HBase client by default creates only one connection per Region Server. When the load was up and running, we used the following command to see the number of HBase connections in ESTABLISHED to the regionServer.
- netstat -an | grep 16020 (16020 is HBase region Server port)
- Normally, the connection is thread safe and can be used safely in multithreaded environment. But, when TPS is high for an API it is better to increase number of connections per region server for better performance. This can be done by setting below properties.
- Solution -
- Set following in HBase Client configuration -
- hbase.client.ipc.pool.type=RoundRobinPool
- hbase.client.ipc.pool.size=5
- For each client connection, based on the load, it will create 5 connections to each Region Server. And the connection will be used in round-robin style.
Comments
Post a Comment