crud
crud copied to clipboard
performance & scalability
What kinda of performance (response times) and scalability (concurrent requests per second) are y'all seeing?
With standard GET requests against a sql database, returning 20 records at a time let's say.
I'm having issues at less than 10 concurrent requests.
@kevinsproles Hello. It should be mentioned, that this is not the "problem" of nestjsx/crud
itself, but the one for typeorm
, because nestjsx/crud
is just a boilerplate code for your controllers and services and under the hood they use typeorm
.
Asking the question about performance and scalability: using the ORM will always produce a new layer of abstraction to the database connection, which, of course, will somewhat slow down the request processing. If you prioritize performance more than comfortability, you should use the original driver of your database, but then you will not have this comfortable CRUD generator and other tools, that simplify your developer life.
Hope I explained it all clear! :)
Well looks like on mysql especially paging suffers on very big queries, the reason lies behind how the pagination queries are generated.
It is not directly TypeORM related, it is related to how you use the selectquerybuilder to create the pagination queries. Below you can find the same pagination query written in 2 different styles which differ in performance like 100x times. So basically the querybuilder implementation needs a bugfix on himself to make the selection queries with paging faster.
SELECT User
.createdAt
AS User_createdAt
,
User
.updatedAt
AS User_updatedAt
,
User
.deletedAt
AS User_deletedAt
,
User
.id
AS User_id
,
User
.id
AS User_id
,
User
.email
AS User_email
,
User
.name
AS User_name
,
User
.surname
AS User_surname
,
User
.username
AS User_username
,
User
.password
AS User_password
,
User
.counter
AS User_counter
FROM user
User
WHERE User
.deletedAt
IS NULL
LIMIT 10 OFFSET 1000000
SELECT * FROM user INNER JOIN (SELECT id FROM User ORDER BY deletedAt LIMIT 25 OFFSET 100000) AS tmp USING (id) ORDER BY deletedAt;