-
SummaryMostly self explanatory from title...I was looking at the example for spawning multiple listeners here: https://github.com/tokio-rs/axum/blob/main/examples/listen-multiple-addrs/src/main.rs This approach seems to drop down to using This seems like an easier to understand pattern...but perhaps there are performance tradeoffs? axum version0.7.7 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
That's a very good question. The discussion at #1063 that led to the example being created doesn't really answer it 😅 Back then with I'd be inclined to just delete the example. @mladedav thoughts? |
Beta Was this translation helpful? Give feedback.
In an ideal world, I think it would be better to have it in one
serve
just so you can't add one later to oneserve
and forget to add it for althe other one. Unless that's what you want of course.But I don't see practical issues with multiple concurrent
serve
calls. Well one that I can think of is that if a user fails to set non-blocking mode on ther TCP listeners then they'll be surprised that one of the servers doesn't seem to work at all. With single listener they'll blocking but it should just work by accident.I think it should be just fine to get rid of the example since now it's needlessly complicated and the way to do this soon-ish will probably be to implement a
Listener
in 0.8 t…