Long pooling

 Mình sẽ giới thiệu loạt bài về các câu hỏi trong lĩnh vực lập trình web, đây là các khái niệm khá cơ bản và có thể sẽ bị hỏi khi phỏng vấn. Một số kỹ thuật có thể đã cũ, tuy nhiên vẫn được đề cập đến, ở đây là 

Long pooling

Đây là giải thích khá rõ ràng về nó

Long polling is essentially a more efficient form of the original polling technique. Making repeated requests to a server wastes resources, as each new incoming connection must be established, the HTTP headers must be parsed, a query for new data must be performed, and a response (usually with no new data to offer) must be generated and delivered. The connection must then be closed and any resources cleaned up. Rather than having to repeat this process multiple times for every client until new data for a given client becomes available, long polling is a technique where the server elects to hold a client’s connection open for as long as possible, delivering a response only after data becomes available or a timeout threshold is reached.


Khi nhắc đến long pooling, các bạn sẽ nghĩ ngay đến từ khoá

Http realtime

Web socket ( kỹ thuật này ra đời sau long pooling)

Server send event


Comments

Popular posts from this blog

Các câu hỏi liên quan đến restful API

Active record (Eloquent) trong Laravel và Data Mapper (Doctrine) trong Symfony

CI/CD diagram, infra