Increase default request rate
Problem
The current request rate of 200 req/s (pg_net.batch_size) is too low for several cases. It's limited this way to save on CPU usage, but this can be improved.
For example, right now the net._http_response tables store the response headers as jsonb. For this, processing is needed on each request/response to convert the headers to jsonb, which consumes CPU.
Solution
Store the response headers as binary and then provide a view that converts them to json on demand. This can be done without a breaking change. Then increase the default request rate.
Notes
- Feedback on twitter about desired throughput https://x.com/martindonadieu/status/1869434542873878711 (200K req/s.. seems like a lot for a single instance, we would need a way to distribute load).
+1, I think the value of pg_net.batch_size is far less than 200. By the way, how can I check the value of pg_net.batch_size? @steve-chavez
@begank Try
show pg_net.batch_size;
do we have a way to have in our migration file the set of batch_size ? when i add that to migrations: alter system set pg_net.batch_size to 2000; ERROR: ALTER SYSTEM cannot be executed within a pipeline (SQLSTATE 25001) At statement 61: alter system set pg_net.batch_size to 2000
@riderx Looks like your migration tool is using libpq pipeline mode, which is incompatible with some SQL statements (COPY being another one).
For now, you could use another migration tool as a workaround.
Once https://github.com/supabase/pg_net/issues/163 is done we won't require ALTER SYSTEM anymore.
I use the one in supabase CLI, so I don’t know exactly witch one it is but i believe your team does :) I would live to have that not require alter and be a method like set_batch_size like we have in others plugins