Обновим наше приложение - на получение записи из базы.
Итого получим. Без базы как обычно (50 юзеров)
Concurrency Level: 50
Time taken for tests: 27.157 seconds
Complete requests: 10000
Failed requests: 0
Requests per second: 368.23 [#/sec] (mean)
Time per request: 135.786 [ms] (mean)
С базой уже
Concurrency Level: 50
Time taken for tests: 63.509 seconds
Complete requests: 10000
Failed requests: 0
Requests per second: 157.46 [#/sec] (mean)
Time per request: 317.547 [ms] (mean)
Time per request: 6.351 [ms] (mean, across all concurrent requests)
Transfer rate: 72.12 [Kbytes/sec] received
Это ужасно. Одно приложение, которое коннектится на одну базу, без баунсера.
Добавим баунсер
Concurrency Level: 50
Time taken for tests: 40.391 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 4690000 bytes
HTML transferred: 2610000 bytes
Requests per second: 247.58 [#/sec] (mean)
Time per request: 201.957 [ms] (mean)
Time per request: 4.039 [ms] (mean, across all concurrent requests)
Transfer rate: 113.39 [Kbytes/sec] received
Стало быстрее, но всё равно очень медленно. pg_stat_activity не выдаёт того, что база работает на полную. В отличие от pgbench запросов
Если в одного юзера только селекты база отдаёт. Каждый запрос - одно соединение (-C):
tps = 470.757538 (including connections establishing)
tps = 900.448771 (excluding connections establishing)
Для 50 пользователей это будет (только селекты -S) и новые коннекты (-C)
tps = 1401.415031 (including connections establishing)
tps = 39028.763458 (excluding connections establishing)
На этом, пожалуй и закончим. Слишком много новых вопросов появилось при работе с базой данных. И с параллельными запросами.
Итого получим. Без базы как обычно (50 юзеров)
Concurrency Level: 50
Time taken for tests: 27.157 seconds
Complete requests: 10000
Failed requests: 0
Requests per second: 368.23 [#/sec] (mean)
Time per request: 135.786 [ms] (mean)
С базой уже
Concurrency Level: 50
Time taken for tests: 63.509 seconds
Complete requests: 10000
Failed requests: 0
Requests per second: 157.46 [#/sec] (mean)
Time per request: 317.547 [ms] (mean)
Time per request: 6.351 [ms] (mean, across all concurrent requests)
Transfer rate: 72.12 [Kbytes/sec] received
Это ужасно. Одно приложение, которое коннектится на одну базу, без баунсера.
Добавим баунсер
Concurrency Level: 50
Time taken for tests: 40.391 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 4690000 bytes
HTML transferred: 2610000 bytes
Requests per second: 247.58 [#/sec] (mean)
Time per request: 201.957 [ms] (mean)
Time per request: 4.039 [ms] (mean, across all concurrent requests)
Transfer rate: 113.39 [Kbytes/sec] received
Стало быстрее, но всё равно очень медленно. pg_stat_activity не выдаёт того, что база работает на полную. В отличие от pgbench запросов
Если в одного юзера только селекты база отдаёт. Каждый запрос - одно соединение (-C):
tps = 470.757538 (including connections establishing)
tps = 900.448771 (excluding connections establishing)
Для 50 пользователей это будет (только селекты -S) и новые коннекты (-C)
tps = 1401.415031 (including connections establishing)
tps = 39028.763458 (excluding connections establishing)
На этом, пожалуй и закончим. Слишком много новых вопросов появилось при работе с базой данных. И с параллельными запросами.
Комментариев нет:
Отправить комментарий