Omar AL Zabir, the co-founder & CTO of Pageflakes has written about a continuous streaming Ajax proxy that solves the common problem that all Ajax proxies have, the double delay in downloading content on server first and then delivering to the browser.
- Read bytes from external server in chunks of 8KB from a separate thread (Reader thread) so that it’s not blocked
- Store the chunks in an in-memory Queue
- Write the chunks to ASP.NET Response from that same queue
- If the queue is finished, wait until more bytes are downloaded by the reader thread
Making a difference And if you wonder what difference this can make:
Content Proxy served about 42.3 million URLs last month which is quite an engineering challenge for us to make it both fast and scalable. Sometimes Content Proxy serves megabytes of data, which poses even greater engineering challenge. As such proxy gets large number of hits, if we can save on an average 100ms from each call, we can save 4.23 million seconds of download/upload/processing time every month. That’s about 1175 man hours wasted throughout the world by millions of people staring at browser waiting for content to download.
There is even more detail on how the proxy has created.
(Ex) Senior Full Stack Developer. Digital Commerce Specialist y CEO CookingMetrics Consultoría Data & Analytics