zacromero3
2019-9-13 07:24:33

Ok, it’s got to be a major garbage collection. Here is an example of one: GC: 0:MAJ @ 375,452K(+206,643K)[+12,164K]; free 29,497K(-28,969K) 185ms @ 94993


chris613
2019-9-13 08:18:27

@lexi.lambda thanks :smile: i think maybe this one one of those times where perfect was the enemy of the good (for me) i jump to the idea of streaming parser but TBH I’m only going to be parsing 10’s or 100’s of smallish files (source code) sure it will be fine :slightly_smiling_face:


pocmatos
2019-9-13 08:23:40

@zacromero3 Interested in the problem you are having. Have you tried RacketCS by any chance?


pocmatos
2019-9-13 10:51:37

Also, I cannot repro your problem without response.rkt. Would you be able to share this code?


zacromero3
2019-9-13 12:45:07

@pocmatos I haven’t tried tried, but that’s a good idea. I’ll try that out. Yeah sure! I’ll put all of this in repo and share it. Thanks :slightly_smiling_face:


zacromero3
2019-9-13 13:23:46

pocmatos
2019-9-13 13:44:45

@zacromero3 perfect, thanks.


soegaard2
2019-9-13 13:45:59

@aymano.osman The code is ready: https://github.com/soegaard/web-tutorial


samth
2019-9-13 13:50:28

@zacromero3 thanks! I ran it, and see something very similar


samth
2019-9-13 13:50:50

samth
2019-9-13 14:15:44

and here’s racketcs:


soegaard2
2019-9-13 14:16:55

Remarkably similar.


samth
2019-9-13 14:17:24

the spikes are the same, but racketcs is really much flatter


soegaard2
2019-9-13 14:17:47

Flatter but more or less the same levels.


samth
2019-9-13 14:18:11

the code always runs for ~400ms


samth
2019-9-13 14:18:14

there’s a timer


soegaard2
2019-9-13 14:18:49

There is an explanation for everything :slightly_smiling_face:


soegaard2
2019-9-13 14:19:02

The spikes have the same height too.


samth
2019-9-13 14:19:38

the racketcs 99 percentile is lower than the racket 95th percentile


soegaard2
2019-9-13 14:20:06

good news


samth
2019-9-13 14:20:22

yes, the racketcs (really chez scheme) collector is very good


badkins
2019-9-13 14:33:35

Cool - thx!


samth
2019-9-13 14:34:19

ok, I weirdly get a bunch of errors around the spikes, all with this error message: write-string: output port is closed output port: #<output-port:tcp-accepted> context...: raise-arguments-error try-again loop loop loop fprintf /home/samth/sw/plt/racket/share/pkgs/web-server-lib/web-server/http/response.rkt:52:0: output-response-head32 /home/samth/sw/plt/racket/share/pkgs/web-server-lib/web-server/http/response.rkt:23:0: output-response/method /home/samth/sw/plt/racket/collects/racket/private/more-scheme.rkt:261:28 /home/samth/sw/plt/racket/collects/racket/contract/private/arrow-val-first.rkt:486:18 loop /home/samth/sw/plt/racket/share/pkgs/web-server-lib/web-server/private/dispatch-server-with-connect-unit.rkt:144:8


samth
2019-9-13 15:06:19

those errors turn out not to be relevant (I think)


samth
2019-9-13 15:06:52

but changing the #:initial-connection-timeout to 2 means those spikes happen every 2 seconds, and there are not major GCs to explain that


samth
2019-9-13 15:18:51

@zacromero3 the spikes are caused by time taken in kill-connection-w/o-timer! in web-server/private/connection-manager. The expensive thing is the calls to close-input-port and close-output-port.


samth
2019-9-13 15:28:03

aymano.osman
2019-9-13 15:45:22

awesome!


zacromero3
2019-9-13 17:06:32

@samth Thanks for helping me get to the bottom of this! Its nice to see racketcs’ garbage collector performs better too.