how to distribute surplus load of user traffic to google app engine from google compute VM ? running django with apache - django

I am running django on google VM instance using apache and mod wsgi... i however am unsure of the concurrent requests that my app shall receive from the users and would like to know if i can transfer the surplus load of the VM to the App engine automatically to prevent the server from crashing.
I am unable to find any solution expect running kubernetes cluster or docket containers to effectively manage the load. but in need to be free of this hassle and send off the excess load to GAE.

If you want to analyze the traffic, latency and load of your resources and applications, I would recommend you to start with Stackdriver Trace.
As per documentation, Stackdriver Trace is a distributed tracing system that collects latency data from your applications and displays it in the Google Cloud Platform Console. You can track how requests propagate through your application and receive detailed near real-time performance insights. Stackdriver Trace automatically analyzes all of your application's traces to generate in-depth latency reports to surface performance degradations, and can capture traces from all of your VMs, containers, or Google App Engine projects.
Once you have determine the user traffic or you have a better idea about this, then you can try using "Instance Groups".
GCE offers two kind of VM instance groups:
Managed instance groups (MIGs) allow you to operate applications on multiple identical VMs. You can make your workloads scalable and highly available by taking advantage of automated MIG services, including: autoscaling, autohealing, regional (multi-zone) deployment, and auto-updating.
Unmanaged instance groups allow you to load balance across a fleet of VMs that you manage yourself.

Related

Why my website that is deployed in Google compute engine VM instance taking too long to load?

My website is taking too much time to load. I have hosted it in a VM instance created from Google compute engine.
My website is built on MERN stack and running with docker compose. I'm using docker scaling for backend application but no load balancing for the client side or the VM.
I would really appreciate if someone helps me out with this issue, I've been searching for days but still couldn't figure out what the issue is.
This is the site link:
https://www.mindschoolbd.com
VM type: e2-standard-2,
zone: nortamerica-norteast2-a
There are few things that we can do to make it load fast :
1)You can optimize your application code (including database queries if you have) - on this part, you can contact your developer as this is out of our scope as well.
Check there are a few situations that may cause the load issue in mobile apps:
i)The MERN Stack - A Practical guide app server may be down and that is causing the loading issue.
ii)Your wifi / mobile data connection is not working properly. Please check your data connection.
iii)Too many users are using the app at the same time. Please try after a few minutes.
Please go through the MERN Stack practical issues for more info.
2)You can upgrade your Machine type and this includes the CPU and RAM of your VM instance and server caching is also part of it.
Check over util of memory and cpu increase, if required change it into something higher than e2-standard-2, As recommended in the SO for more information.
3)Try to have your vm deployed in a region which is near to your location. Suggest to create snapshot and create vm using snapshot and change region.
4)Create a cloud CDN for caching to make it load fast, Cloud CDN lowers network latency & Content delivery best practices, offloads origins, and reduces serving costs. Recommending to use Optimize application latency with load balancing and also installing an Ops agent in your VM instance to have a better monitoring view.
Finally go through the Website Speed Optimization Tips: Techniques to Improve Performance and User Experience for more information.

Increase resources on a Compute Engine VM without shutting services down

To automatically manage Cloud resources in order to meet the felt need of my infrastructure, I need to increase VM resources. But this is possible only while the machine status is TERMINATED.
The problem is that I have got applications on the VMs that must not stop running. Do you have any suggestions about how I could proceed, like increasing my machines resources without interrupting its services? (database, web, etc...)
The purpose of that is to automate my whole infrastructure, to ensure its quality of service even if I'm not monitoring it by myself.
I suggest to take a look to Managed Instance Groups. It will offer some of the characteristics you need: high availability, scalability and the ability to add the instance group to a load balancer.
According to the Google official documentation about MIGs:
Make your workloads scalable and highly available by taking advantage of automated MIG services, including: autoscaling, autohealing, regional (multiple zone) deployment, and automatic updating.
Regarding the need of automation of the services you want, I suggest to generally use fully managed services. You can check a summary of GCP services and you can always inspect if they fit your demands.

Architecture Questions to Autoscale Moodle on Google Cloud Platform

We're setting up a Moodle for our LMS and we're designing it to autoscale.
Here are the current stack specifications:
-Moodle Application (App + Data) baked into an image and launched into a Managed Instance Group
-Cloud SQL for database (MySQL 5.7 connected through Cloud SQL Proxy)
-Cloud Load Balancer - HTTPS load balancing with the managed instance group as backend + session affinity turned on
Questions:
Do I still need Redis/Memcached for my session? Or is the load balancer session affinity enough?
I'm thinking of using Cloud Filestore for the Data folder. Is this recommendable vs another Compute Engine?
I'm more concerned of the session cache and content cache for future user increase. What would you recommend adding into the mix? Any advise on the CI/CD would also be helpful.
So, I can't properly answer these questions without more information about your use case. Anyway, here's my best :)
How bad do you consider to be forcing the some users to re-login when a machine is taken down from the managed instance group? Related to this, how spiky you foresee your traffic will be? How many users will can a machine serve before forcing the autoscaler to kick in and more machines will be added or removed to/from the pool (ie, how dynamic do you think your app will need to be)? By answering these questions you should get an idea. Also, why not using Datastore/Firestore for user sessions? The few 10s of millisecond of latency shouldn't compromise the snappy feeling of your app.
Cloud Filestore uses NFS and you might hit some of the NFS idiosyncrasies. Will you be ok hitting and dealing with that? Also, what is an acceptable latency? How big is the blobs of data you will be saving? If they are small enough, you are very latency sensitive, and you want atomicity in the read/write operations you can go for Cloud BigTable. If latency is not that critical Google Cloud Storage can do it for you, but you also lose atomicity.
Google Cloud CDN seems what you want, granted that you can set up headers correctly. It is a managed service so it has all the goodies without you lifting a finger and it's cheap compared to serving stuff from your application/Google Cloud Storage/...
Cloud Builder for seems the easy option, unless you want to support more advanced stuff that are not yet supported.
Please provide more details so I can edit and focus my answer.
there is study for the autoscaling, using redis memory store show large network bandwidth from cache server, compare than compute engine with redis installed.
moodle autoscaling on google cloud platform
regarding moodle data, it show compute engine with NFS should have enough performance compare than filestore, much more expensive, as the speed also depend on the disk size.
I use this topology for the implementation
Autoscale Topology Moodle on GCP

google cloud compute engine time out window

I have a process (Python) which is running more than 10min. Initially thought of running in Google cloud App Engine, since it has 60 sec time out window planning to run in google compute engine. But I come to know that compute engine also have 10min time out window, but I couldn't find that information in internet.
So thought of checking, Please let me know whether google compute engine also has time out window?
Thanks,
App Engine Standard
App Engine standard environment has a 60 second timeout for HTTP requests and 10 minute timeout for tasks in task queues. App Engine standard runs on a specialized sandboxed environment.
There is also some info here about various DeadlineExceededError messages you could get in App Engine standard and how to handle them.
App Engine Flexible
App Engine also provides an alternate environment (App Engine Flexible aka Flex) which in turn runs on Google Compute Engine (GCE) VMs. It has a timeout of 60 minutes. It also provides more flexibility in terms of languages and runtimes.
Both of the App Engine environments (Standard and Flex) are managed Platform-as-a-Service environments (as in, you need not worry about spinning up the underlying infrastructure and managing them). Google App Engine takes care of this automatically.
You can look at the comparison of App Engine Standard vs App Engine Flex.
Directly using GCE VMs
When you use Google Compute Engine (GCE) VMs directly, they do not have any associated timeouts (except for preemptible VMs which I've described below). A GCE VM will be fully managed by you and you control how long the instance runs.
There are times when your VM can be Live migrated due to ongoing maintenance events, which BTW is mostly transparent to you and your application running on the VM. Your machine could restart at times due to hardware failures which is out of your control, but that's where you need to make your application resilient to such failures. In fact by using App Engine, these details are abstracted from you and fully managed by Google.
Preemptible VMs
Preemptible VMs are lower cost and short-lived GCE VMs which have a maximum duration of 24 hours and can be terminated even before that if GCE wants to use the underlying resources for other purposes. This is more useful for processing batch workloads where there is no strict latency requirements.

Monitoring Server Accessibility(Ping) and Uptime of Windows EC2 instances in AWS

I have a requirement to monitor Memory, Disk, Paging File Usage, Logon Errors, Server Accessibility(Ping) and Uptime of Windows EC2 instances.
I have monitored Memory, Disk, Logon Errors and Paging File Usage using Cloud Watch custom metrics. I was able to do these because I found these counters in my Windows Performance Monitor. But how do I monitor Server Accessibility(Ping) and Uptime?
There are many services which monitor server uptime and response times. Pingdom is a commonly used service. It is most known for http monitoring, but also supports ping checks (among others).
If you want a more integrated solution you can look into setting up a monitoring suite like Nagios or Munin. Most can monitor performance data on the severs as well as external reachability.
I have also compiled an extensive list of windows server performance monitoring tools which might help you in finding the right solution.