03/31/2023, 7:10 AM
Hi, I've a question about profiling. It's a very common concern: where does my handler spends its precious (AWS specially) time? How much time in that pdf rendering service,how much serializing/deserializing, how much booting up, and son on .. Which would be the best/recommended approach? Thanks a lot


04/01/2023, 10:05 AM
if it's a AWS lambda then it does tell you the initialisation time in the trace. Other than that there isn't really an "http4k" way of doing this really - you could use the events system to report timings, or something like OpenTelemetry/distributed tracing . More generally, things like instantiating connection pools/Jackson instances/Loggers can be good culprits to target - it kind of depends on what you're optimising for really. we've found: Jackson -> use Moshi with generated adapters Logging -> use Stdout Connection pools - for DB's your a bit stuck, but for HTTP clients you can use the Java8HttpClient as it doesn't setup a pool at all so has effectively zero init time (as opposed to the JavaHttpClient/OkHttp)