Anvil and the Python Multiprocessing module

Is it safe to use the Python Multiprocessing module in my Anvil app? My app needs to query 16 “lookup” tables when it starts. I’m currently running the 16 queries sequentially, but was wondering if I would get faster performance by running the queries in parallel via the Multiprocessing module, and if would be safe to do so.

Using multiprocessing or threading in an Uplink script would work. I would use threading for parallelising database reads, because it’s IO bound. You’re likely to run into difficulty using either the multiprocessing or threading modules inside a Server Module though, because of the way we handle multiple connections to the Anvil server runtime,

(NB: This answer is subject to change - we’ve got some exciting developments in this area in mind.)

1 Like

Thanks for the info Shaun!

Any developments on this area?