V
V
v- death2015-12-01 20:00:34
go
v- death, 2015-12-01 20:00:34

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))
}

2. Several applications that are divided into API modules (a module that works with users and a module that works with LAN) and they are united by nginx
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))
}

nginx
location /users/ {
        proxy_pass http://localhost:8051;
    }
    location /mail/ {
        proxy_pass http://localhost:8051;
    }

Of course, there will be more than 20 of these modules. And about 500 methods

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Filinkov, 2015-12-01
@vGrabko99

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 question

Ask a Question

731 491 924 answers to any question