This code was copied from FrameworkBenchmarks/light-java. Please see FrameworkBenchmarks for setup instructions and licenses.
I have modified it by adding postgres-async-driver
to the pom.xml
file.
<dependency>
<groupId>com.github.alaisi.pgasync</groupId>
<artifactId>postgres-async-driver</artifactId>
<version>0.9</version>
</dependency>
I have modified the PostgresStartupookProvider
to start up the async.
I have also added an async handler QueriesAsyncPostgresqlGetHandler
that does the same work that the regular update handler does. It listens on /queries2
Prerequisites:
- IntelliJ IDEA
- Apache JMeter
- I had to mess with hidpi settings in
jmeter.properties
- I had to mess with hidpi settings in
- go-wrk
- local postgres installed with all files from the postgres setup
Running instructions:
- Clone repo
- To setup testing, just follow light4j instructions to run (make new run configuration with class
com.networknt.server.Server
) - Use Apache JMeter to test throughput.
- Use go-wrk to test throughput.
JMeter Configuration:
- (Thread Group) Number of Threads (2, 4, or 8)
- (Thread Group) Ramp up: 0
- (Thread Group) Loop Count: forever
- (HTTP Request) protocol: http
- (HTTP Request) server name: localhost
- (HTTP Request) Port Number: 8080
- (HTTP Request) Path: (/queries and /queries2)
- (HTTP Request) Method: GET
- (HTTP Request) Parameters: queries=10
- (Summary Report)
go-wrk instructions:
go-wrk -t 2 -m 10000 http://localhost:8080/queries?queries=10
go-wrk -t 2 -m 10000 http://localhost:8080/queries2?queries=10
I have a Dell XPS 13 inch with UHD; Windows 10 Home; [email protected] GHz; 16GB RAM.
I started the load and kept clearing to get latest throughput. After 15 seconds it calmed down for both.
For reference, the data point on framework benchmark's site for this configuration (queries = 10; light-java; postgres) is 18,069.
I downloaded go-wrk to test as well; 2 Threads; 10,000 requests; 100 connections.
Benchmark Config | /queries?queries=10 req/s | /queries2?queries=10 req/s |
---|---|---|
JMeter 2 Threads | 2736 | 1907 |
JMeter 4 Threads | 4904 | 2208 |
JMeter 8 Threads | 5079 | 2129 |
go-wrk | 1870 | 944 |
It is obviously not my day job to do high throughput systems. I cannot even reproduce within 2x as slow what FrameworkBenchmarks was able to produce. On top of it, I don't even know where to start profiling this. My first and second attempts are not showing any strong results. I've never been able to reproduce the large req/s from FrameworkBenchmarks code and I don't know if that's from my lack of access to awesome hardware, or my poor configuration skills.
Light-4j pros:
- Starts in milliseconds. This is huge.
- Easy to debug/restart/try new things.
- Performance oriented. After configuring postgres correctly, I was able to get high throughput for a windows machine.
Light-4j cons:
- Documentation. I think there is a documentation rewrite happening, as it's extremely hard to navigate and mostly about philosophy and approaches.
- Because of the documentation issue, I'm not sure what it would add to day to day development.
- When I added my class; it was an undertow provider.
- When I implemented my class, I just used async objects.