- Echo Quick Start Guide
- J. Ben Huson
- 225字
- 2021-06-25 21:39:41
Go HTTP web server
A web server's primary purpose is to accept HTTP request messages, process the requests, and respond with HTTP response messages. The web server that is built into the Go net/http package is a wonderful example of a bare bones web server. The web server listens for and accepts new TCP requests, launches a new Go routine for each request, and then runs the developer-specified handler for the request in the new Go routine. The web server implementation watches for any application-level panics that occur within the code and then sends the response generated by the handler code back to the client that initiated the request.
This works due to the lightweight thread scheduling that is done within the Go runtime environment. Go routines are much cheaper to initialize and run than traditional threads and subprocesses, and are designed so that thousands of Go routines can be running at the same time. The following is a high-level diagram of how a request is processed within the Go web server:
As a recap, the Go web server will spawn and execute each handler function within a Go routine for every single request that the web server receives. The Go web server will handle the network's listen and accept life cycles, and has a Transport Layer Security (TLS) built-in if requested by the developer.
- 社交網(wǎng)絡(luò)對齊
- 面向物聯(lián)網(wǎng)的CC2530與傳感器應(yīng)用開發(fā)
- 物聯(lián)網(wǎng)安全與深度學(xué)習(xí)技術(shù)
- HCNA網(wǎng)絡(luò)技術(shù)
- 物聯(lián)網(wǎng)+BIM:構(gòu)建數(shù)字孿生的未來
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- 通信簡史:從信鴿到6G+
- 企業(yè)私有云建設(shè)指南
- 中小型局域網(wǎng)組建、管理與維護實戰(zhàn)
- 搶占下一個智能風口:移動物聯(lián)網(wǎng)
- 通信十年:擁抱互聯(lián)網(wǎng)
- 無線傳感器網(wǎng)絡(luò)定位技術(shù)
- bash網(wǎng)絡(luò)安全運維
- 數(shù)字王國里的虛擬人:技術(shù)、商業(yè)與法律解讀
- Architecting Data:Intensive Applications