pedestal

2020-09-25T15:31:08.012600Z

Hello, everyone how to deal with sharp latency increases during load in pedestal jetty based server? When querying db and sending large json response to 1 request latency is around 700ms, and as i increase requests to 15-25 per second response times grow to 16-27s, how to deal with this? (Standard settings, prod mode, full async and nio)

chrisulloa 2020-09-25T15:59:36.013300Z

Is there anything built into pedestal to let the client specify keys? /posts/42?fields=subject,author_name kind of thing

chrisulloa 2020-09-25T16:00:07.014Z

writing an interceptor but also curious if anything is already baked in

2020-09-25T16:21:12.014700Z

Query params are parsed by default if im not mistaken

2020-09-25T16:22:02.015600Z

/posts/42?fields[]=subject&fields[]=author_name

👍 1
souenzzo 2020-09-25T16:27:19.015700Z

can you exemplify this? Did you use time macro to check if this time is from j/query or any other component? You are using json? cheshire? how do you benchmark it?

souenzzo 2020-09-25T16:30:06.016600Z

@christian.gonzalez you end up re-writting (a part of) graphql

chrisulloa 2020-09-25T16:30:54.017Z

@souenzzo true 😂

souenzzo 2020-09-25T16:31:58.017500Z

#pathom has a "nested select-keys", that may help you https://blog.wsscode.com/pathom/v2/pathom/2.2.0/other-helpers.html

2020-09-25T16:32:05.017700Z

Muuntaja for encoding, wrk2 for testing

chrisulloa 2020-09-25T16:32:37.018300Z

thank you! checking that out, not sure yet if i need to specify nested keys

2020-09-25T16:36:12.018400Z

Also yeah, i used time to look for handler time, it uses fixedthreadpool for queries and does a bit of mapping, the time it takes to complete handler takes 450-550ms

souenzzo 2020-09-25T16:36:14.018600Z

What the request does? Are you sure that your operation isn't blocking the async threads?

2020-09-25T16:37:00.018800Z

Queries are submitted to a fixedsizethreadpool that returns a chan on completion, other than that nothing blocking