@@ -142,16 +142,38 @@ user 0m0.016s
142142sys 0m0.000s
143143```
144144
145+ Memory consumption:
146+ ```
147+ postgres@dev:~$ ### pgsql-http (C)
148+ postgres@dev:~$ ps -u postgres uf
149+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
150+ postgres 13381 2.0 0.1 4613684 24672 ? Ss 07:34 0:00 \_ postgres: postgres test [local] SELECT
151+ postgres@dev:~$ ### plsh
152+ postgres@dev:~$ ps -u postgres uf
153+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
154+ postgres 7805 0.2 0.1 4525780 19324 ? Ss 07:33 0:00 \_ postgres: postgres test [local] SELECT
155+ postgres 8672 0.0 0.0 135024 3288 ? S 07:33 0:00 | \_ /bin/sh /tmp/plsh-hDxrRx https://ya.ru 2
156+ postgres 8673 0.0 0.0 272324 7732 ? S 07:33 0:00 | \_ curl -i --connect-timeout 2 -H Accept: application/json https://ya.ru application/json https://ya.ru
157+ postgres@dev:~$ ### plpython2u
158+ postgres@dev:~$ ps -u postgres uf
159+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
160+ postgres 12235 3.0 0.1 4553668 29636 ? Ss 07:34 0:00 \_ postgres: postgres test [local] SELECT
161+ postgres@dev:~$ ### plpython3u
162+ postgres@dev:~$ ps -u postgres uf
163+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
164+ postgres 10812 3.3 0.1 4562784 32000 ? Ss 07:33 0:00 \_ postgres: postgres test [local] SELECT
165+ ```
166+
145167Conclusion
146168---
147169Results:
148170
149- Method | Latency, ms | TPS
150- ------------ | ------------- | -------------
151- pgsql-http (C) | 235.92 | 42.39
152- plsh (curl) | 306.95 | 32.58
153- plpython2u | 233.74 | 42.79
154- plpython3u | 234.20 | 42.70
171+ Method | Latency, ms | TPS | RSS
172+ ------------ | ------------- | ------------- | -------------
173+ pgsql-http (C) | 235.92 | 42.39 | ~ 24MB
174+ plsh (curl) | 306.95 | 32.58 | ~ 30MB (19324+3288+7732)
175+ plpython2u | 233.74 | 42.79 | ~ 30MB
176+ plpython3u | 234.20 | 42.70 | ~ 30MB
155177
156178The "plsh" approach has an obvious drawback: additional separate ` curl ` process is to be invoked for every query.
157179As a result, it shows slower results compared to [ pgsql-http] ( https://github.com/pramsey/pgsql-http )
@@ -166,3 +188,4 @@ The bottom line: the [pgsql-http](https://github.com/pramsey/pgsql-http) doesn't
166188The plpython2u-based approach wins because:
167189 - it's not slower than pgsql-http
168190 - it's much easier to deploy.
191+ - RAM consumption is not signifcantly worse than in case of pgsql-http
0 commit comments