Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Add PGRBENCH_PGRST_NGNIX_LBS option #35

Merged
merged 3 commits into from
Jun 17, 2022
Merged

Conversation

Lakshmipathi
Copy link
Contributor

Run two postgrest process behind nginx while using
PGRBENCH_PGRST_NGNIX_LBS option

Signed-off-by: Lakshmipathi Ganapathi [email protected]

Run two postgrest process behind nginx while using
PGRBENCH_PGRST_NGNIX_LBS option

Signed-off-by: Lakshmipathi Ganapathi <[email protected]>
@steve-chavez steve-chavez force-pushed the wip/nginx-load-balance branch from 91abae6 to ee30cbf Compare June 2, 2022 18:51
@steve-chavez
Copy link
Member

Looks good! Even on the t3a.nano I'm getting better results.

I've added a commit to DRY the systemd services(ideally we'd use systemd template units but NixOS doesn't support them yet NixOS/nixpkgs#80933).


Not sure if necessary but I'm thinking we should divide the pool size by half and also limit the number of cores a postgREST instance uses with -maxN.

@steve-chavez
Copy link
Member

The throughput is noticeable improved with this change.

Starting from m5a.8xlarge the numbers don't improve that much though. Perhaps it makes sense to try with more postgrest services from this instance?

@Lakshmipathi
Copy link
Contributor Author

| Perhaps it makes sense to try with more postgrest services from this instance?
Yes, correct. We should launch more postgrest depending on no.of cpu core as the instance size gets larger. I'll check and update this PR.

@Lakshmipathi
Copy link
Contributor Author

@steve-chavez I compared 2-postgrest vs 4-postgrest vs 8-postgrest running behind nginx loading balancer on m5a.4xlarge The results are:

  • Running 8-postgrest performs worse than 4-postgrest. And 2-postgrest almost always matches 4-postgrest results except GetSingleEmbed where 4postgrest performs 10% better than 2-postgrest tests. But 2-postgrest produces lesser failure rates than 4-postgrest tests.

So I think we can stick with 2-postgrest for larger nodes.

@Lakshmipathi
Copy link
Contributor Author

m5a.4xlarge results for 2pgrest:

GETAllEmbed
10, 0.00,169.88375/s
20, 0.00,229.646455/s
30, 0.00,229.746686/s
40, 0.00,229.231026/s
50, 0.00,229.068655/s
60, 0.00,228.791604/s
70, 0.00,228.391011/s
80, 0.00,228.035968/s
90, 0.00,227.370761/s
100, 0.00,227.281861/s
150, 0.00,226.197691/s

GETSingle
10, 0.00,7438.584307/s
20, 0.00,11579.30724/s
30, 0.00,12692.671314/s
40, 0.00,12865.474932/s
50, 0.00,12713.171118/s
60, 0.00,12720.380587/s
70, 0.00,12674.112608/s
80, 0.00,12674.832778/s
90, 0.00,12554.371533/s
100, 0.00,12402.584401/s
150, 0.00,11080.187045/s

GETSingleEmbed
10, 0.00,5471.4133/s
20, 0.00,7686.033566/s
30, 0.00,8495.004228/s
40, 0.00,8597.757732/s
50, 0.00,8467.980147/s
60, 0.00,8214.79728/s
70, 0.00,7970.438457/s
80, 0.00,7690.462343/s
90, 0.00,7470.313378/s
100, 0.00,7335.754678/s
150, 0.00,7148.318773/s

PATCHSingle
10, 100.00,10858.848584/s
20, 100.00,13002.774312/s
30, 100.00,12342.582563/s
40, 100.00,11982.644391/s
50, 100.00,11815.712447/s
60, 100.00,11222.135804/s
70, 100.00,10629.912204/s
80, 100.00,10340.139062/s
90, 100.00,11044.355901/s
100, 100.00,11126.808167/s
150, 100.00,10152.694127/s

POSTBulk
10, 0.00,2148.589839/s
20, 0.00,3374.731514/s
30, 0.00,3774.171711/s
40, 0.00,4671.508998/s
50, 0.00,5191.022437/s
60, 0.00,4792.415842/s
70, 0.00,5029.591023/s
80, 0.00,5055.010742/s
90, 62.56,3979.339248/s
100, 100.00,3080.60703/s
150, 100.00,3505.736743/s

POSTSingle
10, 100.00,4659.941627/s
20, 100.00,14461.154965/s
30, 100.00,14282.000445/s
40, 100.00,14175.212135/s
50, 100.00,14085.749513/s
60, 100.00,13657.977323/s
70, 100.00,13728.898899/s
80, 100.00,13323.034611/s
90, 100.00,13327.493535/s
100, 100.00,13225.353212/s
150, 100.00,10831.574988/s

RPCGETSingle
10, 100.00,10884.519757/s
20, 100.00,13442.455507/s
30, 100.00,12514.133825/s
40, 100.00,12055.88743/s
50, 100.00,10921.116162/s
60, 100.00,11631.847201/s
70, 100.00,11416.375661/s
80, 100.00,11604.109181/s
90, 100.00,11668.606853/s
100, 100.00,11321.700347/s
150, 100.00,11166.950015/s

RPCGETSingleEmbed
10, 100.00,10628.441665/s
20, 100.00,10859.506363/s
30, 100.00,9965.316021/s
40, 100.00,9641.970824/s
50, 100.00,9463.114438/s
60, 100.00,9131.789124/s
70, 100.00,9140.8121/s
80, 100.00,9128.527185/s
90, 100.00,8918.842725/s
100, 100.00,8954.257024/s
150, 100.00,8899.858167/s

RPCSimple
10, 100.00,12825.936503/s
20, 100.00,15180.398109/s
30, 100.00,13870.734118/s
40, 100.00,13252.331772/s
50, 100.00,12473.767051/s
60, 100.00,11948.896705/s
70, 100.00,12434.750048/s
80, 100.00,11988.523623/s
90, 100.00,12125.807341/s
100, 100.00,11988.546133/s
150, 100.00,10921.755359/s

ReadSchemaPATCHSingle
10,X,2382.945716/s
20,X,3299.565402/s
30,X,3282.621257/s
40,X,3926.619464/s
50,X,2235.424783/s
60,X,3279.679749/s
70,X,2862.638494/s
80,X,2256.366125/s
90,X,2454.225369/s
100,X,3471.486376/s
150,X,2554.885865/s

@Lakshmipathi
Copy link
Contributor Author

m5a.4xlarge results for 4pgrest:



GETAllEmbed
10, 0.00,170.614599/s
20, 0.00,231.922588/s
30, 0.00,232.181214/s
40, 0.00,231.705512/s
50, 0.00,231.468115/s
60, 0.00,231.28597/s
70, 0.00,230.857095/s
80, 0.00,230.552517/s
90, 0.00,230.041414/s
100, 0.00,229.595409/s
150, 0.00,228.560001/s

GETSingle
10, 0.00,7405.60117/s
20, 0.00,11832.799782/s
30, 0.00,12676.037407/s
40, 0.00,12616.486665/s
50, 0.00,12595.870026/s
60, 0.00,12541.565445/s
70, 0.00,12311.928934/s
80, 0.00,12420.406848/s
90, 0.00,12292.117755/s
100, 0.00,12205.565782/s
150, 0.00,12208.238864/s

GETSingleEmbed
10, 0.00,5568.261713/s
20, 0.00,8385.728524/s
30, 0.00,9412.296249/s
40, 0.00,9730.014922/s
50, 0.00,9786.084404/s
60, 0.00,9732.39799/s
70, 0.00,9668.499487/s
80, 0.00,9518.272593/s
90, 0.00,9422.844297/s
100, 0.00,9257.831648/s
150, 0.00,8877.644366/s

PATCHSingle
10, 100.00,9886.625182/s
20, 100.00,12404.82643/s
30, 100.00,12033.25203/s
40, 100.00,12391.010445/s
50, 100.00,12517.494054/s
60, 100.00,12067.571546/s
70, 100.00,12188.260817/s
80, 100.00,11586.453266/s
90, 100.00,11900.199014/s
100, 100.00,13288.359424/s
150, 100.00,14399.458512/s

POSTBulk
10, 0.00,2215.112789/s
20, 0.00,3328.361876/s
30, 0.00,3995.859737/s
40, 0.00,4818.813979/s
50, 0.00,4569.790863/s
60, 18.00,5168.793611/s
70, 100.00,11434.264307/s
80, 100.00,11456.374788/s
90, 100.00,11582.649866/s
100, 100.00,11532.503857/s
150, 100.00,11363.643744/s

POSTSingle
10, 100.00,11529.260161/s
20, 100.00,14935.814373/s
30, 100.00,11577.060617/s
40, 100.00,13328.104777/s
50, 100.00,11715.846538/s
60, 100.00,11698.322062/s
70, 100.00,11086.142935/s
80, 100.00,11772.837252/s
90, 100.00,12963.9979/s
100, 100.00,13589.886795/s
150, 100.00,13609.034938/s

RPCGETSingle
10, 100.00,12001.460356/s
20, 100.00,15727.544059/s
30, 100.00,13586.428121/s
40, 100.00,14505.518048/s
50, 100.00,15092.36333/s
60, 100.00,13372.400677/s
70, 100.00,14954.681154/s
80, 100.00,14965.920158/s
90, 100.00,14620.942568/s
100, 100.00,13203.978571/s
150, 100.00,14076.422781/s

RPCGETSingleEmbed
10, 100.00,9949.740917/s
20, 100.00,12116.51644/s
30, 100.00,13260.539465/s
40, 100.00,12786.511997/s
50, 100.00,12414.98352/s
60, 100.00,11300.577299/s
70, 100.00,12398.197731/s
80, 100.00,12168.631982/s
90, 100.00,11673.412454/s
100, 100.00,12894.695107/s
150, 100.00,12662.8488/s

RPCSimple
10, 100.00,12212.684308/s
20, 100.00,16116.456268/s
30, 100.00,15757.200785/s
40, 100.00,15717.501769/s
50, 100.00,13736.028933/s
60, 100.00,14161.270077/s
70, 100.00,15167.605859/s
80, 100.00,13689.650277/s
90, 100.00,15023.230141/s
100, 100.00,14775.479953/s
150, 100.00,14521.138266/s

ReadSchemaPATCHSingle
10,X,5591.633602/s
20,X,5158.921181/s
30,X,5606.255246/s
40,X,3555.871148/s
50,X,2549.098715/s
60,X,2317.561562/s
70,X,3978.719069/s
80,X,4731.804075/s
90,X,3058.143679/s
100,X,3792.782466/s
150,X,4679.876274/s

@Lakshmipathi
Copy link
Contributor Author

m5a.4xlarge results for 8pgrest:

GETAllEmbed
10, 0.00,162.102695/s
20, 0.00,167.266801/s
30, 0.00,166.890546/s
40, 0.00,166.581395/s
50, 0.00,166.072316/s
60, 0.00,166.0359/s
70, 0.00,165.999107/s
80, 0.00,165.777881/s
90, 0.00,165.76718/s
100, 0.00,165.625041/s
150, 0.00,164.860827/s

GETSingle
10, 0.00,7400.468126/s
20, 0.00,11287.323241/s
30, 0.00,11789.385666/s
40, 0.00,11781.563705/s
50, 0.00,11814.291927/s
60, 0.00,11780.464721/s
70, 0.00,11673.873235/s
80, 0.00,11623.75242/s
90, 0.00,11577.617937/s
100, 0.00,11481.671537/s
150, 0.00,11483.446519/s

GETSingleEmbed
10, 0.00,5461.947703/s
20, 0.00,7637.721895/s
30, 0.00,8323.575266/s
40, 0.00,8486.658823/s
50, 0.00,8477.813631/s
60, 0.00,8460.544935/s
70, 0.00,8405.09692/s
80, 0.00,8372.7306/s
90, 0.00,8283.465887/s
100, 0.00,8228.478399/s
150, 0.00,7989.330656/s

PATCHSingle
10, 100.00,8720.025475/s
20, 100.00,8609.818363/s
30, 100.00,8629.976643/s
40, 100.00,8548.0264/s
50, 100.00,8539.481544/s
60, 100.00,8853.921616/s
70, 100.00,9958.391867/s
80, 100.00,11470.972233/s
90, 100.00,13597.46222/s
100, 100.00,11176.092348/s
150, 100.00,14405.841887/s

POSTBulk
10, 0.00,2361.390242/s
20, 0.00,3404.679708/s
30, 0.00,4426.262322/s
40, 0.00,4715.12245/s
50, 0.00,4453.947857/s
60, 0.00,4958.312664/s
70, 0.00,5275.624093/s
80, 4.37,5623.595394/s
90, 96.49,3878.725538/s
100, 100.00,3834.870372/s
150, 100.00,3887.341541/s

POSTSingle
10, 100.00,6988.190913/s
20, 100.00,16126.037944/s
30, 100.00,16335.517486/s
40, 100.00,16294.542876/s
50, 100.00,16212.743317/s
60, 100.00,16229.075534/s
70, 100.00,16334.436484/s
80, 100.00,16091.844034/s
90, 100.00,9708.041988/s
100, 100.00,8307.156272/s
150, 100.00,8304.486936/s

RPCGETSingle
10, 100.00,9612.639173/s
20, 100.00,13467.351909/s
30, 100.00,13812.374895/s
40, 100.00,15589.001573/s
50, 100.00,11443.602625/s
60, 100.00,11359.437064/s
70, 100.00,15262.364197/s
80, 100.00,11365.768415/s
90, 100.00,10222.909947/s
100, 100.00,13447.256149/s
150, 100.00,10483.819286/s

RPCGETSingleEmbed
10, 100.00,10858.619536/s
20, 100.00,11254.455464/s
30, 100.00,15352.509429/s
40, 100.00,11529.922041/s
50, 100.00,11388.98909/s
60, 100.00,15291.939105/s
70, 100.00,9154.213994/s
80, 100.00,10002.361932/s
90, 100.00,12601.939431/s
100, 100.00,9849.533201/s
150, 100.00,14778.43507/s

RPCSimple
10, 100.00,10880.706789/s
20, 100.00,11682.984912/s
30, 100.00,15566.607375/s
40, 100.00,11125.029425/s
50, 100.00,9734.018012/s
60, 100.00,13820.618183/s
70, 100.00,9402.196582/s
80, 100.00,14621.130371/s
90, 100.00,11175.906133/s
100, 100.00,11193.814941/s
150, 100.00,14863.798632/s

ReadSchemaPATCHSingle
10,X,2118.955264/s
20,X,2056.975081/s
30,X,4045.384062/s
40,X,4127.390883/s
50,X,3880.531206/s
60,X,2651.908295/s
70,X,2621.500514/s
80,X,3965.07376/s
90,X,4568.707905/s
100,X,5097.690501/s
150,X,5662.486198/s

@steve-chavez
Copy link
Member

So I think we can stick with 2-postgrest for larger nodes.

@Lakshmipathi Cool. Then I think this would be good to merge.

@steve-chavez
Copy link
Member

m5a.4xlarge results for 4pgrest:

Btw, I also tried with 4 pgrest and my conclusions where the same - 2 pgrest is better.

steve-chavez@c93cca2

@Lakshmipathi Lakshmipathi merged commit de1b603 into master Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants