简体   繁体   English

在Jelastic / PHP中,单个节点上的多个cloudlet共享文件空间吗?

[英]In Jelastic/PHP, do multiple cloudlets on a single node share a file space?

I use Jelastic to host a PHP application. 我使用Jelastic来托管PHP应用程序。 Editors can upload pictures through the application that are stored in the file system. 编辑者可以通过存储在文件系统中的应用程序上传图片。 These pictures are stored within the document root and are served on the frontend as eg http://example.com/uploads/123/picture.jpeg 这些图片存储在文档根目录中,并在前端提供,例如http://example.com/uploads/123/picture.jpeg

For the NGinx application server, I have enabled vertical scaling but have a single node, ie no horizontal scaling. 对于NGinx应用服务器,我已启用垂直缩放但具有单个节点,即没有水平缩放。

Picture uploads are not reliable. 图片上传不可靠。 When I update a picture #1 through my PHP admin interface, then update another one, picture #1 has changed back to the old picture. 当我通过我的PHP管理界面更新图片#1,然后更新另一张图片时,图片#1已更改回旧图片。

My question: Are picture uploads sync'ed across multiple cloudlets on a single node? 我的问题:图片上传是否在单个节点上跨多个cloudlet同步? What will happen if I scale horizontally to multiple nodes? 如果我水平扩展到多个节点会发生什么?

My question: Are picture uploads sync'ed across multiple cloudlets on a single node? 我的问题:图片上传是否在单个节点上跨多个cloudlet同步?

I think there is a terminology problem here. 我认为这里有一个术语问题。

Cloudlet: A composite resource unit composed of RAM and CPU usage. Cloudlet:由RAM和CPU使用率组成的复合资源单元。 1 Cloudlet = 128MB RAM and approx. 1 Cloudlet = 128MB RAM和大约 200MHz CPU. 200MHz CPU。 A server (Jelastic refers to this as a 'node') typically uses multiple cloudlets; 服务器(Jelastic将其称为“节点”)通常使用多个cloudlet; eg it may use several GB RAM and/or several GHz CPU at any given moment. 例如,它可以在任何给定时刻使用几GB RAM和/或几GHz CPU。

More details at http://kb.layershift.com/introducing-cloudlets 有关详细信息,请访问http://kb.layershift.com/introducing-cloudlets

Each node is a self-contained (virtual) server, with its own filesystem. 每个节点都是一个独立的(虚拟)服务器,具有自己的文件系统。 So if you have a single NGINX PHP application server, it doesn't matter if it uses 1 or 100 cloudlets (remember, this is only a measurement of RAM and CPU consumption!), it has 1 filesystem and all of the files that you successfully write there will be available for any subsequent requests. 因此,如果你有一个NGINX PHP应用服务器,它是否使用1或100个cloudlets无关紧要(记住,这只是对RAM和CPU消耗的测量!),它有1个文件系统和你的所有文件成功写入将有任何后续请求。

What will happen if I scale horizontally to multiple nodes? 如果我水平扩展到多个节点会发生什么?

Right, you have to be careful here. 对,你必须要小心。 If your application is writing to the local filesystem, you have a problem when dealing with multiple horizontally scaled servers. 如果您的应用程序正在写入本地文件系统,则在处理多个水平扩展服务器时会遇到问题。 This is a very typical scaling problem that every application must deal with. 这是每个应用程序必须处理的非常典型的扩展问题。

If we're simply talking about static resources (eg images), one of the best and simplest ways to handle this issue is to upload all of those to a single server. 如果我们只是谈论静态资源(例如图像),处理此问题的最佳和最简单的方法之一是将所有这些上载到单个服务器。 For example if you have 4 NGINX PHP servers - let's say they load balance your-application.com - you might make one of those servers (or perhaps a completely separate environment) images.your-application.com 例如,如果您有4台NGINX PHP服务器 - 假设它们负载平衡your-application.com - 您可以制作其中一台服务器(或者可能是一个完全独立的环境)images.your-application.com

So you perform the uploads to images.your-application.com, and reference that directly in your HTML when you wish to display those uploaded images. 因此,您可以上传到ima​​ges.your-application.com,并在希望显示上传的图像时直接在HTML中引用。

Remember, images.your-application.com is only responsible for serving the actual images; 请记住,images.your-application.com仅负责提供实际图像; so it's really lightweight and should handle a decent volume simply with vertical scaling - which is completely automatic on Jelastic. 所以它非常轻巧,只需要垂直缩放就能处理好体积 - 这在Jelastic上是完全自动的。

When you need to scale images.your-application.com, the easy way is to take a CDN service (CloudFlare, Incapsula etc.). 当您需要扩展images.your-application.com时,最简单的方法是采用CDN服务(CloudFlare,Incapsula等)。 This will leave images.your-application.com only handling the uploads and the small amount of download traffic which is not already cached at the CDN. 这将使images.your-application.com仅处理上传和少量尚未在CDN缓存的下载流量。

Having the same issue, please read this jelastic tutorial . 有同样的问题,请阅读这个jelastic教程

In summary, jelastic have a script which help you with sincronization, you just have to execute the script and indicate the folders you want to sync in all nodes. 总而言之,jelastic有一个脚本可以帮助您进行sincronization,您只需要执行脚本并指出要在所有节点中同步的文件夹。

Then, everytime you upload a file to those folders, in cuestion of seconds or minutes the files will be available for all nodes; 然后,每次将文件上传到这些文件夹时,在几秒或几分钟的时间内,文件将可用于所有节点; the time is depending of the file size. 时间取决于文件大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM