作为Image Server与Apache的弹性搜索 [英] Elasticsearch as Image Server vs Apache

查看:87
本文介绍了作为Image Server与Apache的弹性搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用弹性搜索查询股票报价。我的浏览器调用弹性集群,它返回< img> 标签内的URL列表。然后,浏览器调用图像(相关报价的库存图表)。这些映像位于单独的Apache 2 http服务器上。两台服务器是相同的Centos四核2.0Ghz,16GB RAM,1Tb高清。



从阅读以前的SO帖子,似乎可以在Elasticsearch中存储base64图像。有没有人在弹性搜索中创建了生产映像服务器,也可能将基准测试与静态Web服务器进行比较?在我的情况下,图像是80到150 kb。



我的具体问题是(1)将文档映像中的图像作为二进制和弹性回复更快返回base64图像而不是< img> 标签,然后需要另一个调用Apache? (2)弹性搜索作为与静态nginx或apache映像服务器相当的映像服务器?

解决方案

Elasticsearch是一个搜索引擎(其中包括),其优点在于快速搜索您的数据。它不是内容服务器。



我将在ES中存储图像的唯一原因是,如果我需要搜索类似图片。在您的情况下,您似乎愿意使用Elasticsearch作为内容服务器来检索您的图像,这将更好地存储在内容传递网络(CDN)上,正如您现在使用第二个Apache服务器一样。



尽管如此,实际上,如果您有几个股票报价单,即不是数百万美元,可以将您的图片的base64存储在ES中。



最好的做法是总是尝试一下,看看你的群集如何处理它。也许对于你的具体用例,这是完全可以的。只是你会在ES上增加额外的负载,这不是首先处理的。



例如,如果你返回十个结果,您的响应将从几KB增长到至少1 MB,您的用户将需要等待转移才能看到一些结果,而如果您将图像存储在其他位置,则至少可以显示结果快速地向用户提供并让浏览器异步处理图像检索,而无需关心。


I use elasticsearch to query stock quotes. My browser calls the elastic cluster which returns a list of urls inside of <img> tags. The browser then calls the images (stock charts of associated quote). These images are on a separate Apache 2 http server. Both servers are identical Centos Quad core 2.0Ghz, 16GB RAM, 1Tb HD.

From reading previous SO posts it seems one can store base64 images in Elasticsearch.

Has anyone created a production image server in elasticsearch and perhaps compared benchmarks to a static web server? In my case the images are 80 to 150 kb.

My specific question is (1) Would it be faster to have the image in my document map as binary and elastic reply back base64 images as opposed to <img> tags which then require another call to Apache? (2) Is elasticsearch as an image server comparable to static nginx or apache image server?

解决方案

Elasticsearch is a search engine (among other things) which excels at providing fast searches for your data. It is not a content server.

The only reason I would store images in ES would be if I needed to search for similar images. In your case, you seem to be willing to use Elasticsearch as a content server to retrieve your images, which would be better stored on a content delivery network (CDN) as you're doing now with your second Apache server.

Pragmatically, though, it's probably ok to store the base64 of your images in ES if you have a few stock quote documents, i.e. not millions.

The best thing to do is always to try it out and see how your cluster handles it. Maybe for your specific use case it's perfectly ok. It's just that you'll be putting an extra load on ES, which it isn't meant to handle in the first place.

For instance, if you return ten results, your response will grow from a few KB to at least 1 MB and your users will need to wait for that transfer to be done in order to see some results, whereas if you stored your images elsewhere, you could at least show the results very quickly to the user and let the browser handle the image retrieval asynchronously without having to care about it.

这篇关于作为Image Server与Apache的弹性搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆