Go 에서 웹 프레임워크 선택이 어렵다.
그 이유는 치우치지 않고 여러가지를 개발자들이 사용하고, 기본 http/net 을 이용하여 만들어서 사용하기 때문이다.
3가지를 전부 깊게 다뤄본건 아니지만 Document 를 참고하고 프레임워크를 이해 하려고 여러가지 문서를 찾아본 뒤
차이점이 보이기 때문에 작성을 한다.
( Gin , Echo ) vs Fiber
첫번째 분류를 이렇게 하고 Fiber 를 먼저 살펴보자.
https://github.com/gofiber/fiber
GitHub - gofiber/fiber: ⚡️ Express inspired web framework written in Go
⚡️ Express inspired web framework written in Go. Contribute to gofiber/fiber development by creating an account on GitHub.
github.com
Fiber 의 Performace 는 압도적이다.
그 이유는
https://github.com/valyala/fasthttp
GitHub - valyala/fasthttp: Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http - GitHub - valyala/fasthttp: Fast HTTP package for Go. Tuned for high perf...
github.com
fasthttp 라는 package 를 사용하여 구현을 했다.
Gin, Echo는 Go 기본 내장된 net/http 를 사용하여 만들어졌다.
fasthttp 라는 package 를 사용하니까 당연히 문제점은
Go 언어가 업데이트 되면 fasthttp 가 업데이트 되어야하고
그에 따라 Fiber 도 업데이트 되어야 하는 이런식의 구조이다.
그래서 아마도 Gin, Echo 보다 업데이트가 늦지 않을까 하지만..
Fiber 개발자들이 일을 열심히 하는것 같다.
가장 큰 차이점은 fasthttp 를 사용한다는 점이고,
가장 압도적인 performance 를 추구 한다.
Gin vs Echo
https://github.com/gin-gonic/gin
GitHub - gin-gonic/gin: Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better perf
Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin. - ...
github.com
https://github.com/labstack/echo
GitHub - labstack/echo: High performance, minimalist Go web framework
High performance, minimalist Go web framework. Contribute to labstack/echo development by creating an account on GitHub.
github.com
Gin 의 github star 수가 제일 많고
Gin 과 Echo 에서 성능적인면은 Gin 이 조금 더 좋다.
Router 쪽에서 차이때문에 성능적인 면이 차이가 있다고 알고 있고
프레임워크 별로 각 문법들이 있는데 Echo 가 가장 쉬운편이고 문서가 잘 되어있다.
선택하기 나름이지만
Document 를 보면서 조금 더 쉽게 개발하려고 하면 Echo
조금 더 찾아보며 여러가지 더 구현을 하면서 성능적인 면까지 신경쓸거면 Gin
가장 좋은 Performance 를 내면서 가장 Go 스러운 프레임워크를 사용할거면 Fiber
2022년 08월 21일
현재 본인이 추천하는 프레임워크는 Fiber
개발자가 열심히 하는 모습도 좋고, 지금도 점점 언급이 나오는 프레임워크지만
앞으로 더 언급 될 프레임워크 되지 않을까 생각 한다.
하지만 프레임워크 사용법은 거의 비슷해서 하나만 제대로 알아두면 나머지도 사용하기 편할거라 생각된다.
'Language > Go' 카테고리의 다른 글
[Go] get file extension (0) | 2022.09.14 |
---|---|
[Go] timestamp Asia/Seoul (0) | 2022.09.11 |
[Go] Time format (2006-01-02 15:04:05) (0) | 2022.07.20 |
[Go] Covert Time Unix to UTC (1) | 2022.07.20 |
[Go] env file ( godotenv ) (0) | 2022.07.06 |