Agent Server memory usage vs. Worker

Hi!

I’ve recently migrated from Worker to Agent Server and have automatically seen an increase of memory usage from ~2GB to ~5GB (in multiple environments), doubling the cloud bills.

Is this normal? Why is it so?

Alright, I was able to reduce memory usage drastically by adding this server option:

server = AgentServer(
    num_idle_processes=1, # <---
)

I did not see any performance drawbacks during my tests.

That is probably fine for testing. But if you plan on higher rates of calls you will likely want a higher number so it keeps warm workers around for next call.