How Long Does It Take to Upload the Website After Update Elastic Beanstalk

Knowing when to walk away from Elastic Beanstalk

First off, this is not a critique of Amazon'due south Elastic Beanstalk — information technology's a great service that allows you lot to deploy web applications without having a lot of in-house DevOps expertise. If you're a young startup looking to deploy your web app on a tight schedule — it's naturally a tempting choice, but sometimes information technology's the wrong pick.

For those in a hurry, I'll be explaining why Rubberband Beanstalk:

  1. ..is a bad option if you need worker processes.
  2. ..isn't suitable for "mission disquisitional" applications.
  3. ..isn't peachy if yous need a lot of surround variables.

Should you lot be worried about these limitations? The answer really depends on how complex your product is. Permit me give you an example.

At Project A, some of our developers were helping one of our portfolio companies, sennder, to calibration their It operations. They had relied heavily on Rubberband Beanstalk service to quickly deploy their application. Just after our developers joined forces with theirs, anybody quickly noticed that Elastic Beanstalk simply wasn't scalable. To empathise the scalability problem, it first helps to understand a bit more about sennder's product.

A mod digital freight forwarder

The sennder platform offers shippers access to a continued fleet of thousands of trucks. The platform uses proprietary technology to automatically manage cargo loads across this fleet— kind of like a load balancer for freight:

  • If y'all want to freight something across Europe, their platform can automatically observe trucks with plenty capacity.
  • If you're a small trucking business with spare capacity, their platform helps to ensure that your trucks e'er accept a full load.

The goal is to salve money for their shippers while helping carriers make money. They too desire to reduce carbon waste by minimizing the number of half-empty trucks on the road.

The platform consists of a front-cease hosted in Firebase and a spider web app deployed in Rubberband Beanstalk. The web app relies on several external systems and processes. For example, it communicates with a service that receives and analyzes GPS data from delivery trucks (this data allows shippers to rails the procedure of their freight "tours"). These kinds of transactions must be performed asynchronously because it can have a while to process the information. And therein lies the first problem.

Rubberband Beanstalk is a bad choice if you need worker processes

The whole point of a worker procedure is to perform a job in the background without slowing downwardly your chief web app. But Elastic Beanstalk doesn't support this option in a scalable fashion.

For instance, sennder's platform relies on dissever processes to update and aggregate tracking information. Additionally, users tin upload information in large CSV files and take that data candy in the groundwork. Withal, Elastic Beanstalk is designed to manage multiple instances of the same process — specifically, a single web app.

Behind the scenes, Elastic Beanstalk uses Amazon Elastic Container Service (ECS) to scale the resources consumed on the Amazon Compute Deject (EC2). Take a await at this diagram from Amazon's documentation:

AWS diagram of a multicontainer surround in Elastic Beanstalk

The diagram is from an article on how to gear up a multicontainer environment. Note that the "PHP-FPM" container is but an case — y'all could run your web app in any language. An Nginx installation, even so, is mandatory. Elastic Beanstalk uses Nginx as the reverse proxy to map the web app to the load balancer on port 80.

You lot tin meet that Elastic Beanstalk supports multiple containers (xanthous) only they are all defined in ane "task" which is deployed to an ECS container instance. A chore is basically an pedagogy to run specific containers.

The problem is that Rubberband Beanstalk abstracts away all the complexity commonly associated with managing chapters in EC2. Information technology adds your containers to a task, defines a service, deploys the tasks to ECS instances which run in an ECS Cluster. You pay for this convenience because Elastic Beanstalk only uses one task or "process" as I mentioned before.

Let'southward compare this with the flexibility of using ECS straight. If you managed a SaaS platform in ECS, yous could have multiple types of tasks. For example, "Task A" could run your main spider web app and "Task B" and "Task C" could practise background piece of work such as processing large file uploads or aggregating data. To scale the workload and manage costs, you could run Task A in many ECS container instances but restrict Tasks B and C to a limited number of instances.

In Elastic Beanstalk, you can't do this — you're stuck with "Job A" which has to run your entire SaaS platform.

Now, there are of course workarounds — 1 option is to run the worker processes in separate threads on the case where the master web app is running. Still, this workaround would make the worker processes difficult to monitor and difficult to scale.

If you need more than capacity for your spider web app containers, you could add more than instances, but you'll be duplicating the worker containers likewise. This is because all the containers that are required to run your platform are divers in a single job and deployed to each case. Only even if you opted for this workaround, you lot'll run into monitoring issues which is why…

Rubberband Beanstalk isn't suitable for "mission-critical" apps

This is because failed deployments are notoriously hard to troubleshoot. If you lot trawl through Stack Overflow, you'll discover many reports virtually processes getting terminated without whatsoever articulate caption.

Take this quote from an older 2016 Medium article about Elastic Beanstalk:

…overall, we didn't know what failed, and it'south never a good thing to non be sure that your auto is in a practiced land…

While the original author had a generally skilful experience with it, this quote sums upward why Elastic Beanstalk is non for the best solution for mission-disquisitional applications.

And when I say "mission critical", I mean an app that should never go down, and if it does, yous need to provide a detailed root cause analysis of what went wrong.

For example, I one time worked for a company that provided over-the-air software updates to continued cars. Their platform consisted of multiple microservices that ran in a Kubernetes cluster. If an outage prevented a vehicle manufacturer from pushing a hotfix out to their customers, information technology was a big bargain — we had to provide a precise explanation and detail the measures that nosotros would have to improve our infrastructure.

You're going to find it difficult to provide kind of that inspect trail if you use Elastic Beanstalk.

Let me use a real-life example to illustrate why.

The mysterious case of the failed deployment

We had a situation where nosotros were deploying a major update within a specific maintenance window exterior normal working hours. The developers needed to take the whole web app down merely we only needed about 10–20mins — or so they thought…

The update in question was a database migration that enabled the platform to support multiple tenants. The developers needed to stop the application temporarily and then that there was no interference with the database while it was beingness migrated. As the web app was redeployed, Elastic Beanstalk reported the stats "OK" for all instances, but for some reason, the complete environs was stuck in a "warning" country. Unfortunately, there are no log files for the unabridged environment, simply private instances.

But when the developers tried to download logs from the instances to troubleshoot further, they found that they couldn't. You lot tin't merely download the case logs when the surroundings is in an "OK" country — just information technology wasn't "OK", so they were no logs to be had.

Next, they tried some solutions which had worked previously:

  • They terminated and restarted the instances (even though they were apparently "OK")
  • They created a new (but identical) version of the app and redeployed it.
  • They rebuilt the entire Elastic Beanstalk environment.

None of this worked.

Later on 4 hours of enquiry and repeated attempts to set the environment, they eventually got it running. But to this twenty-four hours, no one knows why the solution worked and what originally went wrong.

And the solution? They merely created a completely new Elastic Beanstalk surround and copied over the aforementioned configuration files and environment variables. Speaking of environment variables…

Elastic Beanstalk isn't great if yous demand a lot of environment variables

The simple reason is that Rubberband Beanstalk has a hard limit of 4KB to store all key-value pairs.

As the platform got more than complex, our developers had to add more environment variables such as API keys and secrets for third-party systems. One solar day, they ran into this error when trying to deploy:

          EnvironmentVariables default value length is greater than 4096        

The environment had accumulated 74 environs variables — a few of them had exceedingly verbose names. They practical some short-term workarounds such as changing values like "True" and "False" to "1" and "0", but they needed a amend solution. They tried to notice out if there was a way of extending this limit. No luck.

As this Stack Overflow answer explains, Elastic Beanstalk uses another Amazon product, AWS CloudFormation, to provision environments. Then the 4 KB limit really comes from CloudFormation and it's hardcoded into the system (4KB is the default memory page size of Linux kernels on the x86 architecture). Of course, at that place are workarounds for this event. Keys and secrets tin consume a lot of your environment variable assart so many people suggest using another organisation to store secrets, but this limit is still a bit annoying. After all, comparable systems, such as Heroku, do not have this limitation.

When i of our developers contacted AWS support about the issue, a support rep basically told u.s. that Elastic Beanstalk wasn't suitable for our use case and that we should move to a more than advanced product.

So in that location information technology was, direct from the horse'southward mouth. But..

More avant-garde products demand defended DevOps expertise

Like I said in the intro, Elastic Beanstalk is slap-up if you don't have whatsoever in-business firm DevOps expertise. When Projection A offset invested in sennder, the startup only had a handful of developers and an aggressive production roadmap (like most startups). At that place was little time to spend on learning a circuitous deployment organisation — Elastic Beanstalk was easy enough for the developers to deploy their own lawmaking. The trouble was, they had a hard time fixing things when they broke.

And therein lies the paradox. At that place might be people who read this article and think "What? Y'all can find solutions to these problems explained in the documentation…". Simply chances are, they have specialist knowledge, and know where to look (AWS documentation is vast) plus the whole selling point of Elastic Beanstalk is that you don't need specialist knowledge. If you know exactly what Rubberband Beanstalk is doing under the hood, you lot probably don't demand information technology. Y'all could manage your EC2 instances directly.

Afterward supporting this particular logistics startup for a while, we advised sennder to move away from Rubberband Beanstalk in the long term. They fifty-fifty hired a defended DevOps engineer to support this process. And fact final week, our developers helped their team to completely drift from Elastic Beanstalk to EKS — Amazon's managed Kubernetes service.

Things accept been a lot easier since and so — to quote one of the pb developers "it felt soooooo practiced to kill EB".

Conclusion: When is an app non suitable for Elastic Beanstalk?

It all boils downward to the complication of your app and how many background tasks it needs to perform. Elastic Beanstalk should exist fine if y'all're edifice a unproblematic app such as a task tracking tool or an online gift registry.

But let's say you're building an app that has to display different layers of geospatial data on a map (position of trucks, traffic catamenia, estimated arrival). Y'all're constantly processing files uploaded past carriers, recalculating space availability, providing updated price estimations, and sending notifications to thousands of users.

These are all tasks that need to be performed in the groundwork, in separate processes that don't impact the performance of the cadre app and its front. This is not an app you want to run in an Elastic Beanstalk surround which assumes you lot are running your app in i main process.

On top of that, there are many moving parts and interactions with third-political party services and large sums of money at stake if outages occur. In this case, you don't desire to run across unpredictable issues like exceeding a hard limit on environment variables, or an environment that simply refuses to start for no tangible reason.

If all this sounds like anything like a project that you're planning, do what Amazon told us to do — go for a more than advanced production.

About Merlin and Project A

Merlin blogs virtually developer innovation and new technologies at Project A — a venture uppercase investor focusing on early-stage startups. Project A provides operational support to its portfolio companies, including developer expertise. Every bit part of the IT team, he covers the highlights of Project A's work helping startups to evolve into thriving success stories.

Become role of our journey.

Practice you similar technical content? Are you interested in becoming a technical writer for Project A? Nosotros currently accept an opening for a versatile technical writer based in the European union or the Great britain. You can find more than details and submit an application on the relevant careers page.

whislerwhichave.blogspot.com

Source: https://insights.project-a.com/aws-elastic-beanstalk-when-not-to-use-it-b04dc95b2e9c

0 Response to "How Long Does It Take to Upload the Website After Update Elastic Beanstalk"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel