immutant

http://immutant.org Note: dev discussion happens in #immutant on FreeNode IRC.
2016-03-03T14:09:01.000305Z

@yogthos: welcome! :simple_smile:

yogthos 2016-03-03T14:09:12.000306Z

hello :simple_smile:

2016-03-03T14:09:12.000307Z

can you post those traces for @tcrawley please?

yogthos 2016-03-03T14:09:18.000308Z

sure thing

2016-03-03T14:09:58.000310Z

@tcrawley: he's using inc 714

2016-03-03T14:10:57.000312Z

@yogthos: you see no failed requests from the client, right? just these exceptions on the server?

2016-03-03T14:11:07.000313Z

the latter exception is ignorable I think. The former is a problem

yogthos 2016-03-03T14:11:12.000314Z

the client seems fine in the browser at least

2016-03-03T14:11:21.000315Z

what does the code look like that triggers the first exception?

yogthos 2016-03-03T14:11:27.000317Z

but when ab runs it might get some bad responses?

yogthos 2016-03-03T14:11:46.000318Z

so the sample project is here https://github.com/yogthos/luminus-benchmark

yogthos 2016-03-03T14:12:26.000322Z

and that calls out to Immutant here https://github.com/luminus-framework/luminus-immutant/blob/master/src/luminus/http_server.clj

2016-03-03T14:15:25.000324Z

@yogthos: make sure you see the correct port in your log, please :simple_smile:

yogthos 2016-03-03T14:15:40.000325Z

oh right :simple_smile:

2016-03-03T14:16:51.000326Z

this same code ran w/o error on 2.1.2?

yogthos 2016-03-03T14:17:11.000327Z

let me flip the dependency back to make sure

yogthos 2016-03-03T14:18:04.000328Z

I believe it only happens when run functions are chained

yogthos 2016-03-03T14:18:38.000329Z

ok yeah I'm not seeing errors without the incremental build

2016-03-03T14:21:36.000330Z

do you see errors on every request to /json, or just some?

2016-03-03T14:26:18.000331Z

I must be doing something wrong. if I lein run the app, then git localhost:3000/json, I get a 404

2016-03-03T14:26:28.000332Z

@yogthos: ^

2016-03-03T14:26:56.000333Z

hitting / gives me "Hello, World!"

yogthos 2016-03-03T14:28:03.000334Z

oh go to `/io/json

2016-03-03T14:28:10.000335Z

ah, thanks

yogthos 2016-03-03T14:28:10.000336Z

cause that's served by the nested handler

2016-03-03T14:29:07.000337Z

and you don't see the error every request? only intermittently? only under load?

2016-03-03T14:41:34.000338Z

@tcrawley: pretty sure only load. he didn't see it in the browser

yogthos 2016-03-03T14:53:04.000339Z

yeah it's definitely not for every request

yogthos 2016-03-03T14:53:15.000340Z

I ran ab -c 10 -n 1000 <http://127.0.0.1:3000/io/json>

yogthos 2016-03-03T14:53:24.000341Z

and only saw a few exceptions

2016-03-03T14:54:08.000342Z

ok, I'll try the same here and see if I can recreate, then maybe add some debug output to collect more data

2016-03-03T15:05:33.000343Z

@yogthos: do you see some errors every ab run? or only some? I've ran it several times, and tried bumping up -c and -n, with no errors

2016-03-03T15:05:49.000344Z

what OS/java version are you on?

yogthos 2016-03-03T15:12:07.000345Z

I don't see errors on every run, and I'm on os x, jdk 8

yogthos 2016-03-03T15:13:06.000346Z

hmm and now I'm not able to reproduce that either

2016-03-03T15:16:36.000347Z

fwiw, i'm unable to replicate as well

2016-03-03T15:18:02.000348Z

that's troubling - the only way I can see for this to happen is if an exchange gets reused somehow, but I can't see what could cause that

2016-03-03T15:18:17.000349Z

it's troubling that it was there but isn't now, that is

2016-03-03T15:21:37.000350Z

i'm beginning to feel better about undertow not being the bottleneck, though.

2016-03-03T15:22:05.000351Z

the good news is, with ab -c 50 -n 100000 <http://127.0.0.1:3000/io/json>, I see 2.7k req/s with 2.1.2, and 13.2k req/s with 714

2016-03-03T15:22:32.000352Z

@yogthos: is there a simple way to only omit the formats middleware?

2016-03-03T15:25:43.000353Z

@tcrawley: is that an apples-to-apples test without being able to set :dispatch? false?

2016-03-03T15:26:15.000354Z

ah, pb. those 2.7k requests would all be errors

2016-03-03T15:26:21.000355Z

:simple_smile:

2016-03-03T15:26:31.000356Z

you don't see those on stdout?

2016-03-03T15:26:54.000357Z

oh, I do. I just didn't look at std out on the 2.1.2 run :)

2016-03-03T15:26:59.000358Z

haha

2016-03-03T15:28:46.000359Z

@tcrawley: more troubling to me is that i actually see a little better perf from 2.1.2 with dispatch true

2016-03-03T15:29:01.000360Z

than i do with 714 and dispatch false

2016-03-03T15:29:06.000361Z

with :dispatch? true, I see 12.8k req/seq vs. 13.2k on 714

2016-03-03T15:29:17.000362Z

with :dispatch? false on the latter

2016-03-03T15:29:36.000363Z

ab -c 100 -n 100000 http://127.0.0.1:3000/io/json

2016-03-03T15:29:39.000364Z

i'm running that

2016-03-03T15:29:56.000365Z

I'm -c 50

2016-03-03T15:30:11.000366Z

at some point, you'll see contention between ab and the jvm

yogthos 2016-03-03T15:32:03.000367Z

so it sounds like I'll remove the middleware for the techempower benchmark, and we should see very nice performance :simple_smile:

yogthos 2016-03-03T15:32:52.000368Z

sounds like this would be a reasonable default for luminus as well? :worker-threads 200 :io-threads (* 2 (.availableProcessors (Runtime/getRuntime))))

2016-03-03T15:33:40.000369Z

@yogthos: it really depends on your hardware

2016-03-03T15:33:43.000370Z

and your app

2016-03-03T15:35:06.000371Z

@yogthos: the immutant defaults are 1xProcessors for io and 8xIO for workers

2016-03-03T15:35:32.000372Z

you might breach someone's ulimit with 200 workers

2016-03-03T15:36:00.000373Z

and the immutant defaults are undertow's so i kinda yield to their expertise

2016-03-03T15:36:59.000374Z

regardless, as long as you make it clear in your template where to adjust them, i don't think it matters much what you default them to

2016-03-03T15:38:15.000375Z

@tcrawley: i see 12k r/s with 714/false and 15k r/s with 2.1.2/true

yogthos 2016-03-03T15:38:16.000376Z

yeah that sounds reasonable

yogthos 2016-03-03T15:38:36.000377Z

I think I'm going to add a "server tuning" section in the docs and discuss different strategies there

2016-03-03T15:38:59.000378Z

@yogthos: good idea. happy to review when you have something.

yogthos 2016-03-03T15:39:14.000379Z

fantastic I'll definitely take you up on that :simple_smile:

2016-03-03T15:48:16.000380Z

@tcrawley: i still see slightly better perf with 2.1.2/true at 30 clients

2016-03-03T15:55:03.000381Z

@tcrawley: it may be undertow, though. forcing 2.1.2 to use 1.3.18 slows down to 10k r/s

2016-03-03T15:55:10.000382Z

but that's still dispatching

2016-03-03T15:55:36.000383Z

let's try 714 with b9

2016-03-03T16:07:30.000384Z

yeah, that's 16k r/s with 714/false/b9

2016-03-03T16:07:34.000385Z

so undertow got slower

2016-03-03T16:08:45.000386Z

now i feel stupid for bumping wboss up off b9 😞

2016-03-03T16:09:30.000387Z

no harm in going back!

2016-03-03T16:09:56.000388Z

13.5k r/s with 714/true/b9 which makes sense