Answer the question
In order to leave comments, you need to log in
What will work faster?
Hello. Interested in what will work faster
1. A monolith that contains all API calls + nginx
func main() {
router := httprouter.New()
router.GET("/users/save", kontrollers.***)
router.GET("/users/auth", kontrollers.***)
//около 20 методов для работы с юзерами
router.GET("/users/exit", kontrollers.***)
router.GET("/email/new", kontrollers.***)
//примерно 40 методов для лс
log.Fatal(http.ListenAndServe(":80", router))
}
func main() {
router := httprouter.New()
router.GET("/save", kontrollers.***)
router.GET("/auth", kontrollers.***)
//около 20 методов для работы с юзерами
router.GET("/exit", kontrollers.***)
log.Fatal(http.ListenAndServe(":8051", router))
}
func main() {
router := httprouter.New()
router.GET("/new", kontrollers.***)
//примерно 40 методов для лс
log.Fatal(http.ListenAndServe(":8052", router))
}
location /users/ {
proxy_pass http://localhost:8051;
}
location /mail/ {
proxy_pass http://localhost:8051;
}
Answer the question
In order to leave comments, you need to log in
Based on the fact that each connection will be in its own goroutine, the monolith will work faster, because there will be 1 GC (for several, more iron resources will be required). And it's easier to maintain a monolith. And deploy too. BUT! If you are going to grow quickly, it is better to make several modules (microservices) - it will be easier later to scale horizontally.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question