developmentseed / timvt

PostGIS based Vector Tile server.
https://developmentseed.org/timvt/
MIT License
187 stars 27 forks source link

Move Database Introspection to Classes #83

Closed vincentsarago closed 2 years ago

vincentsarago commented 2 years ago

👋 @bitner

This PR does:

breaking change

This reuse code from tifeatures (not yet public) project.

vincentsarago commented 2 years ago

test fails right now with FAILED tests/routes/test_tiles.py::test_function_tile - asyncpg.exceptions.DataError: invalid input for query argument $6: {} (expected str, got bytes) which I think is related to https://github.com/developmentseed/timvt/blob/828768bc133d1c3bb1c5e63b2929d6006abaade5/timvt/db.py#L19-L26 and https://github.com/developmentseed/timvt/blob/828768bc133d1c3bb1c5e63b2929d6006abaade5/timvt/layer.py#L275-L283

vincentsarago commented 2 years ago

FYI: There is a small impact on performance with this PR, we should wait before merging!

This PR

$ siege --file .github/workflows/data/urls_epsg4326.txt -b -c 20 -r 100 > /dev/null
** SIEGE 4.1.3
** Preparing 20 concurrent users for battle.
The server is now under siege...

Transactions:                   2000 hits
Availability:                 100.00 %
Elapsed time:                   3.03 secs
Data transferred:               5.47 MB
Response time:                  0.03 secs
Transaction rate:             660.07 trans/sec
Throughput:                     1.81 MB/sec
Concurrency:                   18.11
Successful transactions:        2000
Failed transactions:               0
Longest transaction:            0.08
Shortest transaction:           0.02

Master

$ siege --file .github/workflows/data/urls_epsg4326.txt -b -c 20 -r 100 > /dev/null
** SIEGE 4.1.3
** Preparing 20 concurrent users for battle.
The server is now under siege...

Transactions:                   2000 hits
Availability:                 100.00 %
Elapsed time:                   2.73 secs
Data transferred:               5.47 MB
Response time:                  0.02 secs
Transaction rate:             732.60 trans/sec
Throughput:                     2.00 MB/sec
Concurrency:                   16.76
Successful transactions:        2000
Failed transactions:               0
Longest transaction:            0.09
Shortest transaction:           0.00
vincentsarago commented 2 years ago

Update on performance, I've ran more benchmark locally and the difference is really small and still faster than pg_tileserv so I think we are 👍