assafmo / SQLiteQueryServer

Bulk query SQLite database over the network
MIT License
51 stars 2 forks source link

Support request and response streaming #2

Open assafmo opened 5 years ago

assafmo commented 5 years ago

We want to read a request line, execute the query, flush the response and continue to the next request line. This will prevent huge requests to buffer in the application's RAM.

The native go http server closes the request body after the first byte is flushed to the response.
So to flush the response as soon as possible we need to read the entire request, and to read the request line by line we need to buffer the entire response.
In both situations huge requests or responses will cause huge RAM usage.

assafmo commented 5 years ago

https://github.com/assafmo/SQLiteQueryServer/commit/c7e49588a2759d5f2eb00dd68bdcdb5a5b15b3e2