Im running Parse Server with LiveQuery enabled.
I built a chat app and locally in the browser it works pretty fine and super reliable.
When I deploy to app engine its not so reliable, i send 2 or 4 messages and maybe they deliver or maybe after the 5th message they all deliver at once. Im not sure whether this is some issue with latency or Google App Engine or the fact that I put Cloudflare on front of app engine. I am running only 1 app engine version/instance of the backend websocket API
Im not entirely sure how to debug this issue either, does anyone know of any limitations with AppEngine and/or Cloudflare with regard to websockets or in general websocket reliability and latency
Related
I have a golang gorilla websocket server hosted on Google App Engine (GAE) that randomly disconnects connected clients after about an hour of being connected (without any activity).
I checked GAE logs and compared timestamps of close events (code 1006) and noticed that the time differences between opening and closing connections are all nearly the same (~60.1 minutes).
Is there a proper way to fix this issue (example: update associated nginx config) for Google App Engine?
I'm fairly certain that this an issue with GAE as I'm unable to reproduce this issue locally/in-development.
I couldn't find any other good ways of hosting an autoscaled/managed server that supports the websocket protocol.
My alternative hosting choice may be kubernetes, but the costs are much higher than GAE AFAIK and K8s is slightly more difficult to manage.
I found a few related stackoverflow links with no proper solutions (mostly migrations to other services or hacks)
example: GAE App Engine Websocket clients are disconnected after 1 hour
It's well documented on GCP docs :
WebSockets are always available to your application without any additional setup. Once a WebSockets connection is established, it will time out after one hour.
I wouldn't suggest creating a Websocket server on a serverless platform because these products tend to scale down over time when there's no requests on it so you cannot guarantee that it will continue holding the connection (also along with the hard limit mentioned).
You can host your Websocket server on Compute Engine. In fact, GAE Flex uses Compute Engine autoscaler. Here's a link if you're interested to see how it works.
I have a relatively small Java app, which I'd like to move over to the Google App Engine. It runs in the console, with no user input needed after the initial startup. I researched a bit on how to deploy it, but all tutorials seem to focus on Java web apps, when I don't really need that. Is it possible to deploy my app if it's not a web app?
App Engine is probably the wrong GCP platform for you - you'd probably be better served just deploying your jar directly onto a Google Compute Engine node. GAE is pretty explicitly oriented around web applications and you'd need to do a bunch of configuration in order to have it work for your use case.
Does your non-web Java app handle web requests? If not, it seems difficult to imagine that you would be able to reach your deployed app and use it for any purpose, once deployed. Your Java app should be able to handle requests, to make deployment worthwhile, and the deployed app useful.
You may find out about how your app should handle requests by reading the How Requests are Handled documentation page.
We run 2 apps on Google AppEngine, one in Python, and one in Java.
The Python app faces the internet and serves browser users or API calls from our smartphone app.
The Python app often communicates with the Java app, which offers workflow engine services.
The Java app is never accessed directly from the internet. This is similar to a service oriented architecture.
Our Java app is configured with 1 resident instance.
However, we often see that when the Python app sends a request to the Java app (which is doing nothing at that moment), that a new Java instance is spawned, instead of having the resident instance serve the request. This way, latencies up to 10 seconds were discovered, whereas the request handling itself takes less than 1 second.
Could it be possible that Google considers a request from one appengine app to another one, as a sort of backend workload, for which throughput is more important than latency? Are there different policies for requests coming from the internet versus requests coming from Google internally (defered methods, cron, ... maybe inter-appengine requests also resorts in this category, which is maybe not always correct).
Google recommended me to run the Java app as a backend of the Python app, and in fact have only 1 single Appengine app, instead of 2.
Some information in this thread:
https://groups.google.com/forum/?fromgroups=#!topic/google-appengine/8O7K3cFzBbY
Any advice on how to force appengine resident instances handle incoming requests, rather than spawn and warm up new instances, which might be good for throughput, but bad for latency?
Have tried to add <threadsafe>true</threadsafe> element to appengine-web.xml on your java app?
I have a web application running on Google App Engine and need to provide near real time updates to connected web clients. One way would be to use the Google App Engine Channels API, but I'm a bit uneasy about using a proprietary solution.
Are there any reliable hosted services allowing for clients to connect using Socket.IO (with all its supported fallback protocols), and a web server solution running on Google App Engine to publish notifications to it? Any other alternatives that offers the same functionality?
You looking for something like beaconpush.com?
I have the same problem as you.
I've thought about using the Channel API as well however the free quota is quite low (100 channels created per day, each client is one channel).
Here's the solution I'm building:
All of the server logic runs in app engine python runtime
app engine serves all the html and client code
I run a node.js socket.io server on dotcloud (using their free tier)
the node.js server sets up an http server that listens to get requests on a few special url endpoints (ie: myapp-on.dotcloud.com/room/[room_id]) and when it gets called it triggers the socket.io broadcast to the appropriate clients
html clients generated on app engine connect to my myapp-on.dotcloud.com
All user input in the client is sent to app engine via a normal ajax post/get
when the app engine server code needs to push something to the client it makes a url fetch on the appropriate url (myapp-on.dotcloud.com/room/[room_id]) that triggers a message push via socket.io to the connected clients
I'm yet to implement this, but sounds like a workable plan
the idea is to keep all the logic in app engine and only use the socket.io server as a message pusher
I'm wondering if anyone knows any script in Python or Java to setup Google App Engine as Load Balancer server?
I choose GAE, because of 100% uptime and free, so it would be the best to setup as Load balancer.
So what I want to do is set up a GAE app (a load balancer application) in "www.domain.com" - using Google Apps, it will share the load to all my servers (with round-robin, or any technique), but when all servers are down, show maintenance page which is host in GAE.
Is this possible?
You could do it, but you'd
incur extra latency by requiring an extra hop from google app engine to your servers
have all your servers public to the web, since otherwise google app engine won't be able to redirect to them Edit: apparently this is incorrect. See Nick Johnson's comment below!
have to implement something in google app engine to keep track of what servers you have up and how and when to route to them
Seems like it might not be worth it, but it'd be cool if you did it and posted some numbers about how it works!