You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/05/17 03:18:55 UTC

[GitHub] [shardingsphere] taojintianxia commented on issue #17684: Use Caffeine instead of GuavaCache

taojintianxia commented on issue #17684:
URL: https://github.com/apache/shardingsphere/issues/17684#issuecomment-1128363501

   ## Compare the performance of Caffeine and Guava Cache in ShardingSphere
   
   I tested the performance of caffeine and guava cache through ShardingSphere-Proxy, and put the test result as following :
   
   ### Test Environment
   | Proxy-Sharding | 5.1.2-SNOPSHOT(Test [PR-17712](https://github.com/apache/shardingsphere/pull/17712) commit before and after performance) |
   | -------------- | ------------------------------------------------------------ |
   | MySQL          | 5.7.26                                                       |
   | Guava Cache    | 30.0-jre                                                     |
   | Caffeine       | 2.9.2                                                        |
   
   
   | **Software**   | **Address** | **Port** |
   | -------------- | ----------  | -------- |
   | Proxy-Sharding | 10.0.0.201  | 3307     |
   | MySQL-1        | 10.0.0.211  | 3306     |
   | MySQL-2        | 10.0.0.212  | 3306     |
   | MySQL-3        | 10.0.0.213  | 3306     |
   | MySQL-4        | 10.0.0.214  | 3306     |
   | MySQL-5        | 10.0.0.215  | 3306     |
   | Sysbench       | 10.0.0.200  |          |
   
   using `Sharding` mode for proxy
   
   ### Test Plan
   use `SysBench` as the testing tool. 1 million records, testing for 5 minutes.
   ```shell
   	$ sysbench oltp_read_only 
   		--mysql-host=$host 
   		--mysql-port=$port 
   		--mysql-user=$user 
   		--mysql-password=$password 
   		--mysql-db=$db 
   		--tables=1 
   		--table-size=1000000 
   		--report-interval=10 
   		--time=300 
   		--threads=100 
   		--max-requests=0 
   		--percentile=99 
   		--mysql-ignore-errors="all" 
   		--rand-type=uniform 
   		--range_selects=off 
   		--auto_inc=off prepare
   ```
   
   test the `oltp_point_select`,`oltp_read_write`,`oltp_write_only` script like following :
   ```shell
   	$ sysbench oltp_point_select 
   		--mysql-host=$host
   		--mysql-port=$port
   		--mysql-user=$user
   		--mysql-password=$password 
   		--mysql-db=$db 
   		--tables=10 
   		--table-size=1000000 
   		--report-interval=5  
   		--time=300 
   		--threads=100 
   		--max-requests=0 
   		--percentile=99  
   		--mysql-ignore-errors="all" 
   		--range_selects=off 
   		--rand-type=uniform 
   		--auto_inc=off run
   ```
   
   ### Test Result
   
   1.point_select
   
   
   | **Threads** | **Guava Cache(QPS)** | **Caffeine(QPS)** |
   | ----------- | -------------------- | ----------------- |
   | 64          | 104332.74            | 105176.71         |
   | 128         | 154790.42            | 156147.71         |
   
   2.read_write
   
   | **Threads** | **Guava Cache(TPS)** | **Caffeine(TPS)** |
   | ----------- | -------------------- | ----------------- |
   | 64          | 5235.67              | 5269.40           |
   | 128         | 7916.64              | 8021.03           |
   
   3.write_only
   
   | **Threads** | **Guava Cache(TPS)** | **Caffeine(TPS)** |
   | ----------- | -------------------- | ----------------- |
   | 64          | 14061.15             | 14054.77          |
   | 128         | 21412.49             | 21501.28          |
   
   as we can see, for the action contains "reading data" operation, the PR contains Caffeine will increase 1% performace to the Guava Cache.
   
   <img width="361" alt="image" src="https://user-images.githubusercontent.com/4112856/168721430-076461f9-36f0-431b-9ead-a9eb058ef4a0.png">
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org