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
@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:
@zacromero3 Interested in the problem you are having. Have you tried RacketCS by any chance?
Also, I cannot repro your problem without response.rkt
. Would you be able to share this code?
@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 perfect, thanks.
@aymano.osman The code is ready: https://github.com/soegaard/web-tutorial
@zacromero3 thanks! I ran it, and see something very similar
and here’s racketcs:
Remarkably similar.
the spikes are the same, but racketcs is really much flatter
Flatter but more or less the same levels.
the code always runs for ~400ms
there’s a timer
There is an explanation for everything :slightly_smiling_face:
The spikes have the same height too.
the racketcs 99 percentile is lower than the racket 95th percentile
good news
yes, the racketcs (really chez scheme) collector is very good
Cool - thx!
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
those errors turn out not to be relevant (I think)
but changing the #:initial-connection-timeout
to 2 means those spikes happen every 2 seconds, and there are not major GCs to explain that
@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
.
awesome!
@samth Thanks for helping me get to the bottom of this! Its nice to see racketcs’ garbage collector performs better too.