Skip to content

Performance issues with lb4 services #10616

Open
@u3ih

Description

@u3ih

Describe the bug

Using @service or @Inject to inject services can lead to performance issues when calling api (although not using them).

i used autocannon for benchmarking
Full command: autocannon -t12 -c1000 -d30 http://localhost:3000/ping

I tried to inject services into the controller (ping.controller). The more services I import and the larger the project, the more req in seconds decreases

Logs

No response

Additional information

I ran the project on 8 CPUs and tried it multiple times. These are the average results I got.

- Without Injection

I ran the autocannon test and got around 680k requests in 30 seconds. image

- With `@service` (around 37 `@service` with the same service file)

I got around 420k requests in 30 seconds. image

- With `@inject` (around 37 `@inject` with the same service file)

I got around 600k requests in 30 seconds. image

Reproduction

https://github.com/u3ih/loopback-benchmarking

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions