Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Compojure with htp-kit and dbcp.clj #22

Merged
merged 1 commit into from
Apr 2, 2013

Conversation

shenfeng
Copy link
Contributor

Another test added to the suite using Compojure, but using http-kit[1] as the server and dbcp.clj[2] to talk to database

  1. http://http-kit.org
  2. https://github.com/http-kit/dbcp.clj

It should run quite fast and make it quite an interesting option.

@goshacmd
Copy link

👍

@TechEmpower TechEmpower merged commit 567ae00 into TechEmpower:master Apr 2, 2013
@TechEmpower
Copy link
Collaborator

Thanks for the contribution @shenfeng

@shenfeng
Copy link
Contributor Author

shenfeng commented Apr 5, 2013

Hi, thanks. I am more than happy to answer any question about http-kit.

http-kit is written in JAVA, I guess it should have better performance than Netty or servlet [1], and a nice Clojure API is exported, so, we can have much better API than Netty or servlet can offer. The combined result is interesting: we have runtime performance and developer performance at the same time.

[1] https://github.com/ptaoussanis/clojure-web-server-benchmarks

@bhauer
Copy link
Contributor

bhauer commented Apr 5, 2013

Hi, Shen. Thanks again for this test for http-kit.

We included http-kit in the runs that we kicked off this Tuesday using @wg's Wrk in lieu of WeigHTTP. We switched to Wrk in order to get latency data but a side-effect is that Wrk is able to squeeze a bit more performance out of the frameworks, so many results have gone up slightly versus our first round of tests.

On our i7 hardware, the results for http-kit are respectable: approximately 68K rps for the JSON serialization test, but that does not rival Netty or Servlets. This has me curious about two things:

  • Are there perhaps additional configuration settings or tuning that we could include in our next round (round 3) to improve the results for http-kit?
  • Have you had a chance to run this particular test in your own environment using Wrk or WeigHTTP (and not ApacheBench)? We avoid ApacheBench because it's single-threaded and tends to hide the real performance potential of servers. Doing so might highlight something.

As with every test, we want to be sure that we're not crippling http-kit by way of some silly configuration oversight.

@shenfeng
Copy link
Contributor Author

shenfeng commented Apr 5, 2013

Are there perhaps additional configuration settings or tuning that we could include in our next round (round 3) to improve the results for http-kit?

http-kit has little to configure.

#setup.py
 command = "lein run -- --db-host " + args.database_host + " --worker=${CPU_CORES}"

# should have better raw performance

Servlet can do 213,322 and netty 203,970? while http-kit's can only do 68k. That's faster than I think.

I can understand netty and servlet faster than http-kit. I've read the netty one's code, it's pretty low level. And I can not beat Java with Clojure: Clojure is write on top of Java :)

I run wrk on the netty and http-kit on a Macbook Air with 1.7 GHZ cpu:

# netty
./wrk -t3 -c400 -r100k http://localhost:8080/
Making 100000 requests to http://localhost:8080/
  3 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    13.06ms    9.30ms  69.33ms   82.43%
    Req/Sec     7.84k     0.95k    9.00k    74.32%
  100096 requests in 3.69s, 17.18MB read
  Socket errors: connect 0, read 266, write 0, timeout 0
Requests/sec:  27151.18
Transfer/sec:      4.66MB
#http-kit
 ./wrk -t3 -c400 -r100k http://localhost:8080/http-kit/json
Making 100000 requests to http://localhost:8080/http-kit/json
  3 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    16.00ms   12.53ms  63.93ms   63.48%
    Req/Sec     5.14k   793.47     7.00k    51.30%
  100017 requests in 5.80s, 16.02MB read
  Socket errors: connect 0, read 808, write 0, timeout 7
Requests/sec:  17240.70
Transfer/sec:      2.76MB

I am curious about the database access performance ranking. I expect it to be slower than netty or servlet.

@shenfeng
Copy link
Contributor Author

shenfeng commented Apr 6, 2013

Hi, I just sent another pull request #103, hopefully, will make http-kit run faster.

@bhauer
Copy link
Contributor

bhauer commented Apr 6, 2013

Excellent. We'll get that applied soon!

@shenfeng
Copy link
Contributor Author

Hi, I just sent another pull request #147.
hopefully, will make http-kit run faster.

michaelhixson added a commit to michaelhixson/FrameworkBenchmarks that referenced this pull request Apr 23, 2018
Here's an example of the error output from before this change:

Unhandled exception:
Bad state: Stream was already listened to
#0      _RawServerSocket.listen (dart:io-patch/socket_patch.dart:1106)
TechEmpower#1      new _ForwardingStreamSubscription (dart:async/stream_pipe.dart:123)
TechEmpower#2      _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:91)
TechEmpower#3      _ForwardingStream.listen (dart:async/stream_pipe.dart:86)
TechEmpower#4      _ServerSocket.listen (dart:io-patch/socket_patch.dart:1351)
TechEmpower#5      _HttpServer.listen (dart:io/http_impl.dart:2278)
TechEmpower#6      _startServer.<anonymous closure> (file:///server.dart:88:12)
TechEmpower#7      _RootZone.runUnary (dart:async/zone.dart:1371)
TechEmpower#8      _FutureListener.handleValue (dart:async/future_impl.dart:129)
TechEmpower#9      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
TechEmpower#10     _Future._propagateToListeners (dart:async/future_impl.dart:665)
TechEmpower#11     _Future._completeWithValue (dart:async/future_impl.dart:478)
TechEmpower#12     Future.wait.<anonymous closure> (dart:async/future.dart:362)
TechEmpower#13     _RootZone.runUnary (dart:async/zone.dart:1371)
TechEmpower#14     _FutureListener.handleValue (dart:async/future_impl.dart:129)
TechEmpower#15     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
TechEmpower#16     _Future._propagateToListeners (dart:async/future_impl.dart:665)
TechEmpower#17     _Future._completeWithValue (dart:async/future_impl.dart:478)
TechEmpower#18     Future.wait.<anonymous closure> (dart:async/future.dart:362)
TechEmpower#19     _RootZone.runUnary (dart:async/zone.dart:1371)
TechEmpower#20     _FutureListener.handleValue (dart:async/future_impl.dart:129)
TechEmpower#21     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
TechEmpower#22     _Future._propagateToListeners (dart:async/future_impl.dart:665)
TechEmpower#23     _Future._completeWithValue (dart:async/future_impl.dart:478)
TechEmpower#24     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:510)
TechEmpower#25     _microtaskLoop (dart:async/schedule_microtask.dart:41)
TechEmpower#26     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
TechEmpower#27     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
TechEmpower#28     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)
NateBrady23 pushed a commit that referenced this pull request Apr 24, 2018
Here's an example of the error output from before this change:

Unhandled exception:
Bad state: Stream was already listened to
#0      _RawServerSocket.listen (dart:io-patch/socket_patch.dart:1106)
#1      new _ForwardingStreamSubscription (dart:async/stream_pipe.dart:123)
#2      _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:91)
#3      _ForwardingStream.listen (dart:async/stream_pipe.dart:86)
#4      _ServerSocket.listen (dart:io-patch/socket_patch.dart:1351)
#5      _HttpServer.listen (dart:io/http_impl.dart:2278)
#6      _startServer.<anonymous closure> (file:///server.dart:88:12)
#7      _RootZone.runUnary (dart:async/zone.dart:1371)
#8      _FutureListener.handleValue (dart:async/future_impl.dart:129)
#9      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
#10     _Future._propagateToListeners (dart:async/future_impl.dart:665)
#11     _Future._completeWithValue (dart:async/future_impl.dart:478)
#12     Future.wait.<anonymous closure> (dart:async/future.dart:362)
#13     _RootZone.runUnary (dart:async/zone.dart:1371)
#14     _FutureListener.handleValue (dart:async/future_impl.dart:129)
#15     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
#16     _Future._propagateToListeners (dart:async/future_impl.dart:665)
#17     _Future._completeWithValue (dart:async/future_impl.dart:478)
#18     Future.wait.<anonymous closure> (dart:async/future.dart:362)
#19     _RootZone.runUnary (dart:async/zone.dart:1371)
#20     _FutureListener.handleValue (dart:async/future_impl.dart:129)
#21     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:636)
#22     _Future._propagateToListeners (dart:async/future_impl.dart:665)
#23     _Future._completeWithValue (dart:async/future_impl.dart:478)
#24     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:510)
#25     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#26     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#27     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:99)
#28     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:152)
msmith-techempower pushed a commit that referenced this pull request Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants