seedwing-io / seedwing-proxy

Policy-enforcing Artifact Proxy
Apache License 2.0
2 stars 3 forks source link

Service comes up four times #8

Closed lkatalin closed 1 year ago

lkatalin commented 1 year ago

It is probably not ideal to have this service come up four times.

    Running `target/debug/seedwing-proxy`
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] ========================================================================
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] OPA server http://localhost:8080/
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy]     policy /example/basic/allow
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] ------------------------------------------------------------------------
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] crates endpoint at http://0.0.0.0:8181/crates-io/
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] m2 endpoint at http://0.0.0.0:8181/m2/
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] ------------------------------------------------------------------------
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] seedwing at http://0.0.0.0:8181/
[2023-01-13T15:40:08Z INFO  seedwing_proxy::proxy] ========================================================================
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates] Creating cargo service with scope /crates-io and url https://github.com/rust-lang/crates.io-index
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /info/refs
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /git-upload-pack
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates] Creating cargo service with scope /crates-io and url https://github.com/rust-lang/crates.io-index
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /info/refs
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /git-upload-pack
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates] Creating cargo service with scope /crates-io and url https://github.com/rust-lang/crates.io-index
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /info/refs
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /git-upload-pack
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates] Creating cargo service with scope /crates-io and url https://github.com/rust-lang/crates.io-index
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /info/refs
[2023-01-13T15:40:08Z INFO  seedwing_proxy::repositories::crates::api] /git-upload-pack
knrc commented 1 year ago

It comes up six times for me. This definitely needs investigating.

jcrossley3 commented 1 year ago

For another data point, I don't see this locally using the main branch. So on average, I guess it happens 3.33 times. :smile:

jcrossley3 commented 1 year ago

Nevermind. After I added the log message, it comes up 8 times for me! Average is 6 now!

lkatalin commented 1 year ago

I discovered the cause of this. It looks like it's a deliberate multi-threading default for HttpServer. If we want to change it, we can specify the number of workers like so:

server.workers(3).bind(bind_args)?.run().await

It could make sense to pass this in a config value at some point, or we can just leave it on default.

More info: https://actix.rs/docs/server/#multi-threading