I have a situation in which I have to increase the Memory of GCP compute instance which is running, and I have to increase the memory without turning it off. I have researched and I found that to increase the memory we have to stop the VM edit the memory and start the VM.
Kindly could someone guide me if there is any workaround to my problem.
If you're running a VM that needs 100% uptime then it should be load-balanced, or GCP only covers 99.5% uptime (up to 43.8 hours downtime a year).
Even with load-balancing GCP only promises 99.99% uptime, which gives up to 52 minutes a year downtime.
The only service Google promises 100% uptime for is DNS as far as I'm aware.
Having been in your position quite a few times I can say that the least painful solution is to schedule downtime to resize the instance.
Beyond that I recommend having an architect look at the infrastructure to see if load-balancing can be added to avoid this in future.
If you haven't already, you can try reducing memory usage on the VM or maybe increasing swap size.