johngao818 / keeplearning Goto Github PK
View Code? Open in Web Editor NEWI Never Lose. I Either Win Or Learn
I Never Lose. I Either Win Or Learn
场景一:
John正在开发一个社区论坛项目,其中有一个需求,需要在前端页面添加一个通知面板,用来实时展示通知信息,比如@某某评论了您的帖子,@某某关注了您,您关注的@某某发表了新的主题帖。John采用了ajax请求轮询方案来实现,首先注册一个定时器,每隔一段时间去调用后端一个接口去获取通知信息。功能上线后,平稳运行。某天论坛的同时在线人数达到峰值,由于服务器配置较低,大量的轮询请求直接导致服务器瘫痪。
场景二:
Kristin正在做一个云计算平台,创建虚拟机是这个平台的一个基本功能,由于虚拟机的创建流程较长,创建接口被设计成异步请求。用户发起创建请求后,立即返回201,告知用户创建正在执行中。待虚拟机创建完成后,需要再次通知用户创建是否成功。但此时由于请求已经结束,无法再次将消息进行反馈。Kristin同样采用了轮询的方案,为了降低服务器的压力,Kristin加大了轮询的时间间隔,但是通知的及时性确被降低了,用户反馈使用体验很不友好。
HTTP协议
缺点:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.