horizonzy commented on PR #2024:
URL: https://github.com/apache/zookeeper/pull/2024#issuecomment-1613450794

   I used the following code as a performance benchmark, and started a 
standalone zookeeper on my laptop.
   
https://github.com/horizonzy/zookeeper/commit/affbb05a1b7f7f3f97fa79f41229169810b09770
   Dividing time by count gives the average time per request.
   
   Use https://github.com/brownsys/zookeeper-benchmark as the bench client.
   Tune the benchmark.conf
   ```
   # Example configuration for ZooKeeper benchmark.
   
   # Length of each test in milliseconds.
   # Can also be set on the command-line.
   totalTime=30000
   
   # Interval in milliseconds between request rate measurements.
   # Can also be set on the command-line.
   interval=20
   
   # Target number of operations to submit, will be topped-off as needed
   # Can also be set on the command-line.
   totalOperations=20000
   
   # Submit more requests when the number outstanding falls below this amount.
   # Can also be set on the command-line.
   lowerbound=8000
   
   # Whether requests should be submitted synchronously or asynchronously.
   # Can also be set on the command-line.
   sync=false
   
   # List of ZooKeeper servers to connect to.
   server.1=127.0.0.1:2181
   server.2=127.0.0.1:2181
   server.3=127.0.0.1:2181
   server.4=127.0.0.1:2181
   server.5=127.0.0.1:2181
   
   #server.1=127.0.0.1:2181
   #server.2=127.0.0.1:2182
   #server.3=127.0.0.1:2183
   
   ```
   
   ### Before this changes:
   Use Alibaba/Arthas to get the metrics.
   ```
   [arthas@95644]$ ognl '@org.apache.zookeeper.server.ServerStats@time'
   @AtomicLong[
       serialVersionUID=@Long[1927816293512124184],
       unsafe=@Unsafe[sun.misc.Unsafe@17b20755],
       valueOffset=@Long[16],
       VM_SUPPORTS_LONG_CAS=@Boolean[true],
       value=@Long[116413386],
       serialVersionUID=@Long[-8742448824652078965],
   ]
   [arthas@95644]$ ognl '@org.apache.zookeeper.server.ServerStats@count'
   @AtomicLong[
       serialVersionUID=@Long[1927816293512124184],
       unsafe=@Unsafe[sun.misc.Unsafe@17b20755],
       valueOffset=@Long[16],
       VM_SUPPORTS_LONG_CAS=@Boolean[true],
       value=@Long[13108831],
       serialVersionUID=@Long[-8742448824652078965],
   ]
   [arthas@95644]$ ognl '@org.apache.zookeeper.server.ServerStats@maxLatency'
   @Long[320]
   ```
   **avg: 116413386/13108831=8.88053145242318**
   
   ### After these changes:
   ```
   [arthas@96369]$ ognl '@org.apache.zookeeper.server.ServerStats@time'
   @AtomicLong[
       serialVersionUID=@Long[1927816293512124184],
       unsafe=@Unsafe[sun.misc.Unsafe@59d92f9b],
       valueOffset=@Long[16],
       VM_SUPPORTS_LONG_CAS=@Boolean[true],
       value=@Long[31908309],
       serialVersionUID=@Long[-8742448824652078965],
   ]
   [arthas@96369]$ ognl '@org.apache.zookeeper.server.ServerStats@count'
   @AtomicLong[
       serialVersionUID=@Long[1927816293512124184],
       unsafe=@Unsafe[sun.misc.Unsafe@59d92f9b],
       valueOffset=@Long[16],
       VM_SUPPORTS_LONG_CAS=@Boolean[true],
       value=@Long[13024907],
       serialVersionUID=@Long[-8742448824652078965],
   ]
   [arthas@96369]$ ognl '@org.apache.zookeeper.server.ServerStats@maxLatency'
   @Long[412]
   ```
   **avg: 31908309/13024907=2.4497916952497243**
   
   
   
   


-- 
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-unsubscr...@zookeeper.apache.org

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

Reply via email to