防止请求垃圾邮件
场景
具有地图功能的客户端应用程序。地图是一个交互式控件,在移动/缩放时将从切片服务器请求切片(根据需要) - 在本例中为 GeoServer。当用户在交互式地图上移动时,图块服务器接收对图块的请求。 让我们想象一下,客户端可以发出的请求数量没有限制。
问题
当用户快速移动时,对图块服务器的请求会堆积。切片服务器陷入困境,无法及时提供切片。
此外,图块请求队列按请求顺序进行响应。因此,用户可以从佛罗里达州前往加利福尼亚州,并且必须等待佛罗里达州的图块加载才能看到加利福尼亚州的任何图块。
问题
我们如何提高客户的感知绩效?
客户端可以采用哪些策略来防止快速平移时出现大量请求?变焦快吗?
服务器端可以采用哪些策略来确定是否不再需要某个请求或应该采取较低的优先级?
可能的解决方案
在图块服务器前面放置一个自定义代理,以便可以使用时间戳来请求图块 - 后面的图块始终会获得优先级。代理还可以实现允许客户端应用程序放弃请求的功能。
先感谢您。
Scenario
A client application that features a map. The map is an interactive control that upon move/zoom will request tiles (as needed) from a tile server -- a GeoServer in this case. The tile server receives requests for tiles as the user moves around the interactive map. Let us imagine that there is no limit on how many requests the client can make.
Problem
When a user is moving fast, requests to the tile server pile up. The tile server gets bogged down and is not able to provide tiles in a timely fashion.
Additionally, the tile request queue is responded to in request order. So, the user could go from Florida to California and have to wait for Florida tiles to load before seeing any tiles in California.
Questions
How can we improve the perceived performance of the client?
What are some strategies to employ on the client-side to prevent a large amount of requests when panning fast? Zooming fast?
What are some strategies to employ on the server-side to determine if a request is no longer needed or should take lower priority?
Possible Solution
Place a custom proxy in front of the Tile Server such that tiles could be requested with a time-stamp -- later tiles always receiving priority. The proxy could also implement a feature allowing the client application to abandon a request.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查看了有关停止图像加载的各种解决方案。但似乎没有人找到一种方法来在浏览器已经开始下载图像时停止加载图像。
所以,我可以推荐替代方案。浏览器限制每个域最多可进行 2 次并行下载。因此,这意味着您需要从不同的子域加载不同位置的图像,以便浏览器可以并行加载多个位置。
因此,假设加利福尼亚州图像来自:
california.yourwebsite.com/images
佛罗里达州图像来自:
florida.yourwebsite.com/images
此外,您可以针对不同的缩放级别使用不同的子域,这样,如果某个缩放级别的图像仍然是加载和用户更改缩放级别时,浏览器可以立即下载新的缩放级别图像。
Zoom10.florida.yourwebsite.com/images
为此,您需要从域面板创建 *.yourwebsite.com DNS 映射到您的网络服务器。
这能回答你的问题吗?
I looked at various solutions on stopping image loading. But it seems no one has found a way to stop loading an image when browser has already started downloading it.
So, I can recommend alternative. Browser has a limit of 2 parallel downloads per domain. So, that means you need to load images of different locations from different subdomain so that browser can load multiple locations in parallel.
So, say california images are coming from:
california.yourwebsite.com/images
And florida images from:
florida.yourwebsite.com/images
Moreover, you can use different subdomain for different zoom level so that if images for a certain zoom level are still loading and user chages zoom level, browser can download the new zoom level images immediately.
zoom10.florida.yourwebsite.com/images
For this, you need to create a *.yourwebsite.com DNS mapping to your webserver(s) from your domain panel.
Does this answer your question?