GCP - Rolling update max unavailable [closed] - google-cloud-platform

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 months ago.
Improve this question
I am trying to understand the reasoning behind the GCP error message.
To give you the context,
I have 3 instances running 1 instance per zone using managed instance group.
I want to do an update. I would like to do the update one by one. So max unavailable should be 1. However GCP does not seem to like it.
How to achieve high availability here if I give max unavailable 3?

The reasoning behind the error is because when you initiate an update to a regional MIG, the Updater always updates instances proportionally and evenly across each zone, as described in the official documentation. If you set the number of instances lower than the number of zones, then the update could not be proportionally and evenly across zones.
Now, as you said, it does not make much sense from the high availability stand point; but this is because you are keeping the instance names when replacing them, and this forces the Replacement method to be RECREATE instead of SUBSTITUTE. The Maximum Surge for the RECREATE method should be 0 and that is because the original VM should be terminated before the new one is created in order to use the same name.
On the other hand, using the SUBSTITUTE method allows configuring a maximum surge that will be enforced during the update process, creating new VMs with a different name before terminating the old ones, and thus always having VMs available.
The recommendation then is to use the SUBSTITUTE method instead to achieve high availability during your Rolling Updates; if for some reason you need to preserve the instance names, then you can achieve high availability by instantiating more than 1 VM per zone.

I don't think that's really achievable, in your context since there is only 1 instance per zone.. in a managed instance group, it would not be highly available if 33% of your instances would be unavailable, so rather it will be 99% and after the update the high availability is on again.
I would suggest giving a good good read to [1] in order to properly understand how MIGs availability is defined on GCP, essentially you could of have had 2 2 2 and then have 2 2 2 update and again 2 2 2.
Also please check [2] As it's a proven example of my 33% statement above.
[1]
https://cloud.google.com/compute/docs/instance-groups/regional-migs#provisioning_a_regional_managed_instance_group_in_three_or_more_zones
[2]https://cloud.google.com/compute/docs/instance-groups/regional-migs#:~:text=Use%20the%20following%20table%20to%20determine%20the%20minimum%20recommended%20size%20for%20your%20group%3A

Related

Google Professional Cloud Exam Question -high traffic / relational databases crashes/replica is never promoted to a master [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
During a high traffic portion of the day, one of your relational databases crashes, but the replica is never promoted to a master. You want to avoid this in the future.
What should you do?
A. Use a different database
B. Choose larger instances for your database
C. Create snapshots of your database more regularly
D. Implement routinely scheduled failovers of your databases
I feel that the answer should be 'C'.
Explanation:
Take regular snapshots of your database system.
If your database system lives on a Compute Engine persistent disk, you can take snapshots of your system each time you upgrade. If your database system goes down or you need to roll back to a previous version, you can simply create a new persistent disk from your desired snapshot and make that disk the boot disk for a new Compute Engine instance. Note that, to avoid data corruption, this approach requires you to freeze the database system's disk while taking a snapshot.
Reference: https://cloud.google.com/solutions/disaster-recovery-cookbook
However, there are so many varied answers from other sources and now I am confused.
Can someone please help? Thanks a zillion.
To select the best answer you must determine what is the question. Questions often have key items that affect the best answer.
What is the question?
The question is how to avoid database crashes.
What are the key items in the question?
High traffic
Only during a portion of the day
There is a replica
The replica is not promoted
Do all of the key items apply? Sometimes key points are not relevant to the question to test your understanding. In this case, the replica is that item. None of the answers involve a replica. That leaves you with two key points:
High traffic
Only during a portion of the day
Of the four answers, eliminate the ones that do not apply to the question. These answers are not good answers to the key points of the question.
Use a different database. Changing the database could mean significant changes to the application design. In most cases, this is not a good answer.
Create snapshots of your data more regularly. Snapshots are for backup and recovery. They do not prevent database crashes. In fact, if snapshots are performed too often, for example, when the database is under heavy load, you are more likely to make the problem worse.
implement routinely scheduled failover. This will not prevent a database from failing. This will help you recover after a failure.
That leaves one answer:
Choose larger instances for your database
Most database systems are not auto-scaling. That means you must select an instance size that can handle peak traffic loads. Only one of the answers provides for that fundamental requirement.
The question being asked is how to avoid a replica not being promoted to primary, NOT how to avoid a crash.
The crux of the problem here is that the replica was not promoted.
Testing failover is would ensure that replica are in fact able to assume primary roles.
Very good analysis for cracking sometimes confusing exam questions.
However, the question doesn't seem to be about avoiding crashes. It is about avoiding replicas not being promoted to master after the crash. So in this case only D makes sense.

Regarding Amazon ELB structure? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to use Amazon ELB plus EC2 for fault tolerance (high availability)
In particular, it is not clear how it supports the following high availability features:
Does it have preemptive migration?
Checkpointing?
Job migration?
Self-detection?
Fault mask?
And is it proactive or reactive?
Does ELB have..
1) preemptive migration I suppose it could be configured to detect early failure somehow by hooking the health checks up to something within your application that could detect an early failure. But it's not part of the design strategy. Nodes are marked as bad and new nodes are brought on, this method isn't part of how AWS is supposed to work. The nodes are thought of as immutable
2) Checkpointing The idea of duplicating data across nodes as part of a regular process isn't part of the AWS high availability vision. The HA of data tends to take place at a database layer, not as data on nodes
3) Job Migration The use of "sticky sessions" allows users to continue with the same data even in the event of a system failure. How the job data is exactly persisted isn't controlled by the ELB.
4) Self Detection In the context of an ELB this is pretty much what the health checks do. But the health checks detect failure in the downstream nodes, one has to imagine the system as being ELB+nodes
5) Fault Mask This is more of a low-level thing, I don't see how it applies to ELB
I suppose that many of your questions would be better addressed as queries about the database layer. AWS RDS has an interesting set of HA capabilites

AWS Server Size for Hosting [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am looking into purchasing server space with AWS to host what will eventually be over 50 websites. They will have many different ranges of traffic coming in. I would like to know if anyone has a recommendation on what size of server that would be able to handle this many sites.
Also, I was wondering if it's more cost effective/efficient to host an separate EC-2 instance for each site or too purchase a large umbrella server and host all sites on a single instance?
Thanks,
Co-locating services on single/multiple servers is a core architecting decision your firm should make. It will directly impact the performance, security and cost of your systems.
The benefit of having multiple services on the same Amazon EC2 instance is that they can share resources (RAM, CPU) so if one application is busy, it has access to more total resources. This is in contrast to running each one on a separate instance, where there is a smaller, finite quantity of resources. Think of it like car-pooling vs riding motorbikes.
Sharing resources means you can probably lower costs, since you'll need less total capacity.
From a security perspective, running on separate instances is much better because they are isolated from each other. You should also investigate network isolation to prevent potential breaches between instances on the same virtual network.
You should also look at the ability to host all of these services using a multi-tenant system as opposed to 50 completely separate systems. This has further benefits in terms of sharing resources and reducing costs. For example, Salesforce.com doesn't run a separate computer for each customer -- all the customers use the same systems, but security and data is kept separate at the application layer.
Bottom line: There are some major architectural decisions to make if you wish to roll-out secure, performant systems.
The short correct answer:
If those sites are only static(html, css and js). EC2 won't be necessary because you can use S3 and it will be more cheap and you won't have to worry about scaling.
But if those sites have a dynamic part like php, python and similar. Well it is a different story.

AWS - EC2: Why would I need more than one instance? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Sorry if there is an obvious answer to this, but I'm currently in the process of setting up a new company, from where I'll be hosting client websites. Rather than use an external hosting company, I'd like to take full control of this through EC2.
Can multiple websites be hosted on a single instance, or will each new site require it's own instance?
Many thanks,
L
Multiple websites can be hosted on one instance, given that the instance is large enough to handle all the traffic from all the different websites.
Here are two main reasons you would use more than one EC2 instance:
Load: A single instance would not be able to handle the load. In this case you would want to start up multiple servers and place them behind a load balancer so that the load can be shared across them. You might also want to split out each site into separate clusters of EC2 servers to further distribute the load.
Fault tolerance: If you don't design your system with the expectation that an EC2 instance can and will disappear at some point, then you will eventually have a very unpleasant surprise. With your site running on multiple servers, spread out across multiple availability zones, if a server or even an entire AZ goes down your site will stay up.
You don't say if each client will require the same code base or if each client will have a different site, but modularity is also important.
What happens if one client requires a different AMI. Say one client requires some special is package for the server. You don't want to keep updating everybody's app every time you have a new client requirement.
So, multiple instances will allow you to scale each customer at different times and rates and will allow you to develop each solution without affecting each other.
Pricing will also be cheaper as you can use auto scaling to be very efficient about CPU used at any given time, compared to a big instance where you will need to estimate future use.
In short, the biggest value of the cloud is elasticity and modularity, so use that in your favor.
In addition to what Mark B said in his answer about load and fault tolerance, having multiple instances allows you have them in different regions of the world. This is helpful if you have requirements concerning the legality of where the data can be stored or more usually about the latency between the data and the user-application. Data stored in an EU region is going to have much less latency for EU users than data stored in a NA region.

Can the way a site is coded affect how much we spend on hosting? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
Our website is an eCommerce store trading in ethically sourced loose diamonds. We do not get much traffic and yet our Amazon bill is huge ($300/month for 1,500 unique visits). Is this normal?
I do know we are daily doing some database pulling twice from another source and that the files are large. Does it make sense to just use regular hosting for this process and then the Amazon one just for our site?
Most of the cost is for Amazon Elastic Compute Cloud. About 20% is for RDS service.
I am wondering if:
(a) our developers have done something which leads to this kind of usage OR
(b) Amazon is just really expensive
IS THERE A PAID FOR SERVICE WHICH WE CAN USE TO ENSURE OUR SITE IS OPTIMISED FOR ITS HOSTING - in terms of cost, usage and speed?
It should probably cost you around 30-50 dollars a month. 300 seems higher than necessary.
for 1500 vistors, you can get away with using an m1.small instance most likely
I'd say check out the AWS trusted advisor service that will tell you about your utilization and where you can optimize your usage, but you can only get that with AWS Business support (100/month). However considering your way over what is expected, it might be worth looking into
Trusted advisor will inform you of quite a few things:
cost optimization
security
fault tolerance
performance
I've generally found it to be one of the most useful additions to my AWS infrastructure.
Additionally if you were to sign up for Business support, not only do you get trusted advisor, but you can ask questions directly to the support staff via chat, email, or phone. Would also be quite useful to help you pinpoint your problem areas.