Node.js on Google App Engine Goes Beta
cloudplatform.googleblog.com
cloudplatform.googleblog.com
We were paying $200/month for a load balanced EC2 setup in 2011, that's for around 2k unique daily users. The load balancer kept on false triggering new instances, so we went to GAE in 2012.
Since then our uptime has been horrifically good, heavily thanks for GAE, trashing that of our competition, who mostly use AWS.
Last month we paid $150 for everything on GAE, traffic, CPU, etc. G-Analytics shows a peak of 54k daily uniques last week. All the scaling is dealt with for us, we can handle literally any traffic peak. i.e. x27 more traffic, lower cost, better uptime, spending virtual zero time looking at the operations side of things.
This is a mission critical app, although, we've never invoked support, so I can't comment on that side.
A post on this topic that I made a month ago: https://news.ycombinator.com/item?id=11159840
Thanks again Google! =)
I think Heroku is usable with a similar level of effort -- and you have a much easier migration path to something else if you're not using Google's proprietary datastore IMO.
It's important to understand that that Appengine is not AWS. It is a massively distributed system providing scalability and fault-tolerance that you would need something like ten AWS servers spread over several availability zones to replicate.
Slow - true, request responses can be several times slower than a single AWS server. That latency is due to the distributed nature of the datastore and memcache - but that buys completely seamless scaling. So if you think you need speed to handle lots of requests, you don't. Appengine will spin up as many instances as you need to manage your traffic.
Expensive - I'm a nasty mean bugger so if there was a cheaper option, I'd take it. A single server on AWS might be slightly cheaper, but ten AWS servers spread over several availability zones (and the sysadmin to manage them) are definitely not.
OSS - ummm, you haven't read the article, have you? You have access to the source code of pretty much everything.
Stable - in the early days of the master-slave datastore, we did have occasional outages. But in the last four years we've had a single outage that affected our customers. I thank my lucky stars every time AWS has a hiccup. Furthermore when there is an outage, I know there are better sysadmins than I could ever afford dealing with it.
At the end of the day, it's the usual horses for courses. If you like doing your own sysadmin, Appengine will fill you with horror. But if you are a developer, Appengine abstracts the system admin away so you can concentrate on doing what you do best.
Google seems to be giving a lot of love to GAE recently, especially with Managed VMs. They have delivered substancial improvements to the reliability of the platform.
EDIT: note that the issue I mentioned only affected 1.29% of the apps on GAE according to Google.
You may want to take a look at Managed VMs. All of the new runtimes are based on Docker images, are entirely extensible, and don't require the use of the original App Engine APIs:
https://cloud.google.com/appengine/docs/managed-vms/
You can use whatever Database or NPM modules you want.
One suggestion: Make a cloud storage product option free up to a few megabytes for hosting small personal sites. Maybe it exists already but I haven't found it.
There are a ton of options on what you can achieve inside the free tier. But the simplest one for the use case you seem to require is to author a static html site in a good WYSIWYG html editor and then deploying it as a static site in GAE.
Edit: My use case is to move a couple of static sites to a host that supports a secure HTTPS connection by default, which App Engine seems to do: <https://cloud.google.com/appengine/docs/python/console/using.... I'll try moving one of my sites over and set up SSL with with a certificate from <https://letsencrypt.org/>.
I'm currently trying to get my feet wet on GAE. Judging from your statement, are you suggesting that people should look into Managed VMs and maybe skip the regular GAE (or known as the original GAE)?
Perhaps the original GAE will be deprecated in the future?
Disclaimer: I work on Compute Engine, not App Engine but I'm familiar enough with their thinking.
I'm also very excited to see GCP people responding to any GCP questions and/or clarifying its past "reputation" with a calm manner ;). Clearly the tide has changed (probably comes from the top too? :)).
Me and my partner are planning to invest a significant amount of time to the GCP ecosystems!
2014 App Engine is also different from 2016 App Engine, hopefully a lot of the problems you had have been addressed.
(I work for Google Cloud Platform)
https://github.com/AppScale/appscale
Disclaimer: I work at GCP, so I'm geeked about open approaches to solving problems :)
Last year I moved a personal project (https://www.gitignore.io) over to Heroku and it's been awesome. My whole application runs in memory on a single free dyno. the service uptime has been great and Heroku's pipeline system (Which is basically like Amazon's internal pipeline system) is really good for testing in staging and then going to production.
[1] Managed VM is a sort of meet-half-way service from Google that is quite freeform like Compute Engine, but also offers access to a good chunk of App Engine's services. Still, it's very much not the standard App Engine.
I want real GAE. Not managed VMs. I want to be able to spin up a quick GAE version on a deploy, and if it doesn't get the traffic to scale up, then it just sits there and doesn't cost me anything.
Managed VM has 2+ instances running all month and is an incredible PITA to spin down if I need to temporarily. (The current workaround is to deploy a non-VM app and set that as default, which is just insane.)
GAE apps based on Managed VMs need a free quota as well. I have many apps but some of them don't do much most of the time. A couple will spike hard randomly. I don't mind paying when it does. I like the security that if/when something really takes off, GAE has my back.
In the meantime, I'll stick to Go on GAE. I'd love to be able to use Node, but things add up quickly if I have a couple hobby apps.
I'm glad that they are pushing Node and I'm a HUGE fan of the Google Cloud. I just really want Node as a native GAE thing.
Is there any plan to implement Node fully on GAE?
https://support.google.com/cloud/answer/6090602
But specifically:
> “Business” status means that you'd like to see a potential economic benefit from your development activities, for example: using the Google Cloud Platform to develop prototypes or applications with a view to generating revenue in the future. Most software developers -- including affiliates, sole traders, self-employed merchants, partnerships, students and others -- use Google Cloud Platform for business purposes.
I can't help you decide what your VAT on the use of our services would be (this is the realm of accounts and lawyers). I know AWS makes a different decision than we do, and we're very aware of the friction (again, sorry!).
Disclaimer: I work on Compute Engine, but again IANAL.
The platform has a lot of quirks, and I had to do a lot more learning than I expected to get the fairly simple project done. But once it was up, it did it's thing.
I'd definitely recommend for free hosting internal applications and personal projects that are just for you to use. Just understand that you'll need to shape your application around the wierdnesses of the platform.
If you were to try again today, you'd take stock Django 1.9 via pip install Django -t lib and using vendoring: https://cloud.google.com/appengine/docs/python/tools/librari... . You point it at your Cloud SQL instance in your DATABASES line (https://cloud.google.com/appengine/docs/python/cloud-sql/dja...) and you're done.
tl;dr: Yep! Things have improved in the last 5 years.
Disclosure: I work on Compute Engine.
[1] https://github.com/GoogleCloudPlatform/appengine-django-skel...
Pointing at your Cloud SQL instance (maybe using a staging or development database) can be done in settings.py. The switch between modes let's you specify the IP address for your Cloud SQL instance when you're not on App Engine (which uses a special UNIX domain socket). We also recommend you connect over SSL when doing so outside (see more at the link I provided, or search for cloud sql ssl).
Having a local environment for MySQL is also easy enough depending on your box, but has the usual difficulty of needing to have a good test suite / being populated with useful data. I think it's worthwhile if you can pull it off, but I've seen companies big and small decide its not worth it (and instead use a separate table or database on the same server, maybe as a different user as another line of "don't screw up prod").
Finally, the interaction between Django's development server and the App Engine one isn't great. My response was intended to remind people that if you're not looking to use App Engine specific APIs you really can just get going and almost not notice. But you should be able to run your migrations speaking to Cloud SQL remotely without needing to import say Task Queues. So my workflow was to use manage.py for things like that, while using the dev_appserver when I actually needed to emulate App Engine (as opposed to the Django runserver command).
Does that help?
Edit: I forgot to add that we're working on decoupling the "emulation" of our services so that this kind of interop works better. See https://cloud.google.com/sdk/gcloud/reference/beta/emulators... for Datastore and PubSub (and more on the way).
I'll get this documented somewhere.
Disclosure: I work on GCP.
Something I found really awesome about Google's services is that they provide fake local implementations that you can run from the CLI. This means that you can run tests without having to hit the outside world!
Somewhat related to that, if you're using S3, check out s3rver [0]. It's a node implementation of fake-s3 [1], which is a local implementation of S3 that you can use during development and testing.
Looking through the examples, I'm confused about the deployment strategy for SPAs. Looking at the webpack example [2], you build the frontend app every time the server runs? That's REALLY slow for any reasonably sized SPA :(. It means you generate a new build each time the server restarts, and for something like node that's really common. (AFAIK, the suggested strategy is to just let it crash and restart quickly.) But it also means that you might have multiple servers running different version of your dependencies (since there's no shrinkwrap). Even worse, if you're running multiple servers with slightly different dependencies, it might also mean that you'll end up building slightly different versions of your SPA in every server for any given release! I'd love to see an example where you build and tag the SPA in a single place, and you make sure all the servers are serving the same bundled code.
[0] https://github.com/jamhall/s3rver
[1] https://github.com/jubos/fake-s3
[2] https://github.com/GoogleCloudPlatform/nodejs-docs-samples/b...
When you deploy with the gcloud cli a Docker image will be packaged for you and and deployed. You could easily run a webpack build before the image is packaged so the built files get packaged as well, or extend the image with your own Dockerfile to customize the Docker steps, or build the image yourself locally and deploy your already built image, etc...
The Node.js runtime on App Engine Managed VMs encourages you to write against public APIs for Cloud Platform (and other) services - including the public Datastore API, which means your code on Managed VMs is written similarly to how you might write it anywhere else. As such, there's no limit to the potential APIs you might want to emulate.
The gcloud CLI tool does early support for emulating two of the more popular Cloud Platform APIs used by Managed VMs customers, and we hope to add more - you can read more in [1]. In this way you can locally emulate services when writing code that talks to them, independent of the platform you choose to deploy too.
As to builds, your application is re-built at deploy time (not run-time) as a Docker image, cached, and distributed out to new instances as needed. As with all Docker builds it is hermetic and so any code running is the same across all instances for a given version.
(Disclaimer: I work on Google Cloud Platform).
[1] https://cloud.google.com/sdk/gcloud/reference/beta/emulators...
Of course, the alternative is to commit your built/minified frontend code to the repo, but that's easy & doesn't really require an example.
I know the conventional wisdom is "never commit compiled code" but a lot of the reasoning behind that idea doesn't really apply to JS built for the browser. FWIW my usual setup is to have a dev server which rebuilds the frontend SPA like this on every re-deploy/restart - but for production releases, I build locally into a `build` directory and commit it to my repo, and the production server only serves code from `build`. That way I don't have to build on every commit, just when I'm putting new code in prod.
- Alpha means sub par quality / rough edges / unresolved issues.
- Beta means fairly stable but no SLA, no guarantees from Google.
So I'd guess it's fine to use now.Custom runtimes are trying to give people the "No Ops" of App Engine with the flexibility of Compute Engine. Like always, there are tradeoffs, but more options is usually better :)
(I work for Google Cloud Platform)
The issue is here[0] and it would seem they still haven't addressed it a year later.
[0] https://code.google.com/p/googleappengine/issues/detail?id=1...
As for Java, well -- guess who announced Java to the world at Moscone Center in SF 21 years ago...? One Eric Schmidt, then Sun's VP for SW products (he reminisced about that this morning at his Next keynote)... who just happened to be Google's CEO when Java was announced as GAE's 2nd language!
But, there's no requirement that you use Datastore. The point of App Engine is that it's "you just give us code, we run it for you". With Managed VMs (built on top of Compute Engine) we're able to offer that programming model with a more flexible environment.
As someone mentioned elsewhere, there's even "just hand us a random docker container". We've had people run ffmpeg because you can just hook up App Engine's request/response and autoscaling to an arbitrary thing, and you've got an autoscaling web service.
tl;dr: Don't get hung up on the old "extreme weirdness of App Engine", this is different.
In the transition , without any warning, google took the app down, for a day. Thus killing all chance of acquiring a userbase now that I had hit the frontpage.
When I went onto the IRC GAE channel to ask someone for help to unlock or keep the app running during this important moment the reply from a staff member was ' You should have planned better'. I was surprised to hear this response and did not pursue the matter further. Its all in the IRC logs if any of this sounds doubtful.
TL;DR; Surprisingly, I did not find the GAE platform to be a supportive environment for startups.
The reason I'm asking is that I've been active in the GAE IRC channel for 6 years and I don't remember anything like this ever happening. I do remember a few cases where people have come with similar problems complaining that their free quota ran out and then regular people telling them that they need to start paying to use the service further.
There really hasn't been an active Googler in the GAE IRC channel for many years, so that fact makes all of this particularly fishy.
Thanks for the reply.
I would like to retract the statement that it was a member of staff, you are correct, this may have not been the case. It was a while ago and it may have just been someone in the know, who didn't actually work for google.
I didnt expect anyone to even notice my comment.
I should have been more careful with my statements.
I will be removing the comment when HN allows me to log back in (apparently I can log in again in about an hour).
> I will be removing the comment when HN allows me to log back in.
In that case, here's a copy of your initial comment, because removing
top-level comments that have ongoing follow-up discussion makes for
very confusing discussions: > All I know about GAE is that when my python app started being used
> by HN users I upgraded my account to a paid one to increase
> performance.
>
> In the transition , without any warning, google took the app down,
> for a day. Thus killing all chance of acquiring a userbase now that
> I had hit the frontpage.
>
> When I went onto the IRC GAE channel to ask someone for help to
> unlock or keep the app running during this important moment the
> reply from a staff member was ' You should have planned better'. I
> was surprised to hear this response and did not pursue the matter
> further. Its all in the IRC logs if any of this sounds doubtful.
>
> TL;DR; Surprisingly, I did not find the GAE platform to be a
> supportive environment for startups.
>
> ionwake @ ~2016-03-21 22:xx UTCDisclaimer: I work on Compute Engine not on App Engine.
I just want to say, this happened a year ago, and things may have changed.
I just had to make the statement as it hit close to home and Ive never mentioned it previously.
Hopefully there is a system/warning in place so apps arent taken down, without warning like this, when transitioning from a free to a paid account ( I think it was to do with the quotas like you said).
All the best and thanks for the reply.
But if you're really scared of that, farm out the entire operations system to a company like vmfarms. They'll take care of everything for you. A bit more expensive but they will hold your hand the entire way.
Well they say right there in the article: "App Engine provides developers with a great platform for building web applications and services that need to operate at Google scale."
</s>