Now 2.0
zeit.co
zeit.co
Now 1.0 really was my perfect deployment tool: you can HTTP POST it a Dockerfile and it will build that container for you, start it running and start routing HTTP traffic to it.
This means you can use it for essentially anything that can be expressed in a Dockerfile. And the Dockerfiles you use work anywhere that runs Docker, so local development is really simple.
Now 2.0 is a totally different thing. It's a way of running HTTP fronted lambda-style functions written in Go, Node, Python or PHP. It looks like you can add other platforms by writing a new builder but there aren't any community-driven examples of that just yet.
It's cool, but it's a completely different product from Now 1.0 - and for my particular use-cases (my Datasette project and serving machine learning models) it sadly doesn't appear to be suitable.
I kind of wish this was called something else - "Zeit Lambda" perhaps - and old Zeit Now with the Dockerfiles could live on as a separately named project (rather than being the legacy earlier version of Zeit Now).
A great example of this is "doing work in a loop". Sure, you can spin up a process and try to schedule work yourself. At that point you're responsible for monitoring, and addressing all its failure modes.
In the 2.0 world-view, you can delegate a lot of the tough synchronization and scalability problems to the platform instead.
I totally understand how 2.0 is cheaper and more scalable, but the trade-offs are that it's much less suitable for serving occasional requests for data that depends on large server-side files (in my case machine learning models and SQLite databases, both which can be 100s of even 1000s of MBs).
I guess what I'm saying is that for my specific use-cases I don't need a Now that's cheaper and scales more easily - 1.0 already had the performance and price that I needed.
Now 2.0 (or Now Lambdas) do look amazing for cheaply handling a vastly scalable amount of incoming requests that don't need to work with a large blob of data on the server. Now v1 remains my perfect environment for hosting scale=1 persistent servers that can serve those large data blobs. I'm finding it hard to imagine a platform that can combine the best of both worlds - but I'm exciting to see if you can indeed pull it off with 2.0.
There's value in distributed architectures, but there are already lots of ways to add that complexity when you need it. I really liked what Now 1.0 was doing (more user-friendly than hyper.sh), so this makes me somewhat sad.
There are very cheap competitors such as Apex Up for managing AWS lambdas if people want to go that route.
I hope I'm wrong about some of the above and you have plans I'm simply not foreseeing to address these issues.
Also, look at it from their perspective. They support everything when they support Docker, no need to have specific tooling for Node.JS.
As a matter of fact, this is an example of executing `now --regions all` :)
It’s not that I couldn’t upgrade, surely I could. It’s inconvenient but not impossible. The problem is that I need my hosting to be as reliable and invisible as possible. Being informed that I need to change my infrastructure out of the blue is unacceptable unless it’s because there is a security reason or perhaps because I am using severely outdated technology. I will now have to spend precious development time figuring out which alternative will match my build process etc.
I think you did the right thing
VM/Containers allow people to develop and structure the app however they want, largely decoupled from deployment/infra.
I don't understand how many people have no issue being told to rewrite your apps so they fit inside lambdas...
Also, while V1 still exists for the time being it is fair to assume that future updates will only apply to V2. One user on here already found this to be true because although a new region was added, GRU, they could not deploy to it with V1 and was told it only supported V2.
How could I achieve it in Now.2.0? Should I wrap Jupyter server with a custom gateway index.py? Before I give it a try, I’d like to hear advice from your team.
https://github.com/zeit/now-builders
It seems that it might be possible to write a bulder like @now/jupyter to automatically deploy Jupyter notebooks with a requirements.txt. The questions are:
1. Is your team going to write it?
2. Is it possible for a third party to write it and put in the now.json?
{
"version": 2,
"builds": [
{ "src": "*.py", "@thirdparty/jupyter" }
]
}Surely, some code changes are necessary to go serverless (when considering legacy servers and apps), but our goal is to always minimize that.
(1) "Behind the scenes, Now 2.0 works like an extensible build system and compiler, capable of transforming your sources into static files and serverless functions (lambdas) for production."
The demo is pretty slick. I've seen other frameworks, like Begin.com, where your lambdas are more explicit, but I'm curious to try this autogenerated approach.
(2) "The Now 2.0 platform features include: A unified deployment type: All deployments are one type, regardless of static or dynamic parts Massive build parallelization: Each deployment can kick off many concurrent serverless builds. Monorepo support: Define API endpoints in Go, PHP, Node.js, Next.js, and such, in just one repository. Zero-instruction builds: Our open-source builders take the build and cache config burden away. Universal Cloud: Our platform leverages the best cloud infrastructure, with no lock-in or config. With the following pricing improvements: Fully on-demand pricing, Per-100ms pricing for compute, Free seats for small teams Including a better free-tier for our community."
It feels like all the Zeit features are coming together for a more complete offering. I love it.
Some small adjustments will be necessary when _importing_ large legacy codebases, but that's where using functions to also build your project comes in!
What fraction of Now customers care about cost and scalability so much that they will invest time into splitting monolithic server into many lambdas (a monorepo). (I've read in Now 2.0 docs that it is recommended to have 1 lambda per 1 API route.) EDIT: After splitting, is there overhead in managing many lambdas vs monolith server?
Once a server is split and configured, will these customers be able to migrate out of Now 2.0? From what I see right now, it is basically a vendor lock-in.
Is it possible that majority of Now's customers are websites, simple CRUD apps, small SaaS apps and they don't care about cost and scalability that much and won't add lambda-related overhead to their code?
Do you guys try to shrink your customer base and work with perhaps bigger clients with critical apps who are more paranoid about scaling, cost and want to invest in lambdas?
Sorry about typos.
All, I want to do is provide a Dockerfile that included a cross-platform build process. Including now specific build tools is not ideal for avoiding vendor-lock in.
Now has amazing for us to build prototypes, internal sites etc that we may eventually move to our standardized AWS infrastructure. Adding now specific build tools makes the process unusable for us
I understand from the docs that Now 1.0 is not deprecated yet, but it bothers me to invest more time in converting some of our internal projects to Now
Also, does ZEIT have any plans to offer hosted databases like Heroku and others do? That's one the biggest blockers in my mind to trying it out.
The problem also ofc already exists when you have multiple applications (or instances) trying to talk to your db (which is why pgbouncer exists regardless of serverless), and serverless doesn’t differentiate between 1 and 1000 instances (which is why its trivially scalable).
And ofc if you werent going to need sufficient scale to require something like pgbouncer... should you even be transitioning to serverless? You could replicate the same stateless organization style on your own, on a single server.
If you're not running the database server yourself, is it so unimaginable that the service provider might have already configured PgBouncer on top of the database as an optional way to interface with it?
Regardless, "serverless" has never meant that there are no servers involved, it just means that for the serverless pieces of your application, you don't have to concern yourself with where or how they're run, only with the application logic itself.
If you want to go 100% serverless, then you're obviously going to have to choose a DBaaS that works with your connection pooling strategy, especially if that strategy is "I don't have one." Supposedly, based on comments on this thread, DynamoDB works pretty well for that scenario. Obviously Postgres doesn't scale with an increasing number of connections very well, which is why PgBouncer exists, and it works well.
Finally, PgBouncer is relatively stateless. Its main pieces of state are a static config file and the pool of open connections it holds. This could be deployed in a serverless fashion, and any time it is destroyed or recreated, it would be trivially reinitialized just from the config. It doesn't have to have any attached, mutable storage.
Are you familiar with any providers that offer this configuration? In my experience, at least AWS does not.
Edit: https://devcenter.heroku.com/articles/postgres-connection-po...
NOW currently doesn't have databases and tells you to use cloud DBs. So more than likely the connection is dropped when the lambda shuts down.
But if you'll let me go a little bit meta, the idea of serverless is that you shouldn't even be thinking about things like connection pooling. If you just use the databases that your provide supports those types of concerns are their concerns now, not yours.
In other words, if you want to pick your own tech stack then serverless is not for you (yet). If you're willing to surrender your opinions and just use what the platform provides you (if you're using AWS just use DynamoDB) then you can stop thinking about these problems and focus on your business logic.
Even if your lambda drops a connection after it destroys itself, a sudden influx of visitors to your site may spawn enough lambda processes to overload your DB.
What happens then is dependent on the database, but generally means that new lambdas do not get to connect.
Anyhow, you don’t really want your database to magically more around regardless, so you’d be sort-of locked in to one service regardless of what you do.
But postgres on one service is pretty much the same as on another, so if you wanted to migrate it would be fairly easy.
However, this is not the case for all databases. Furthermore, modern database vendors are extremely motivated to address the serverless usecase
I like that the cold boot up performance for a single function is super fast when compared to a "Legacy Server". But after the legacy server is up it "stays warm" regardless of user activity. Unlike a lambda function which goes cold after a few minutes of inactivity.
So the first user that hits an endpoint after some inactivity has to wait (a few seconds) for the lambda function to cold boot vs. being served immediately on the legacy server.
Is my assumption here true? Or are cold boots on lambda super fast now? When I was doing this stuff ~8 months ago it would take like 5+ seconds to be served after a cold boot.
GCP has a semi-hacky solution that provides the ability to connect to your managed dbs from your Cloud Functions; one would hope that AWS can at least match that soon.
With the Now 2.0 design, you instead are very likely to not suffer from cold instantiation to begin with, due to the healthy constraints imposed by the system.
In other words, instead of ignoring cold boots, you just want to embrace them and make them minimal to begin with.
https://zeit.co/docs/v2/platform/upgrade-to-2-0#don-t-rush-t...
The limits are there specifically to help in that transition, to avoid the problem described in the chart. They're a crucial learning extracted from the beta we ran.
https://zeit.co/blog/now-dockerfile ??
Like I understand the benefits of lambdas/serverless. But they aren't sufficient for all use cases. The ability to have an endpoint for a docker container with one command is extremely useful. There already a lot of serverless options on the market too... maybe I'm confused...
{"version":1}
Based on that, it seems to me like I will have to migrate to Now 2.0 eventually.
The reason I'm still on DO is because I need dependencies that are both large and trivial to install in docker vs. creating a custom EC2 image. To make it clear I was hoping to deploy a docker container with ffmpeg to support long running video conversions whilst benefiting from easy deploys and on demand pricing. It seems like the potential for this alluded to in the serverless docker announcement has been removed?
I can see how this V2 makes serverless simpler but the strict limits will mean that transitioning a monolithic app requires a lot of work up front. Increasing the limits would reduce that friction greatly. Whilst not best practice deploying an existing express app and have it 'just work' is a compelling reason to go serverless.
The space of 'easy deployment' and 'scale' seems incredibly crowded, from reading the headlines - what makes this different/better?
If you look at the solutions out there, they all involve you dealing with low-level APIs or config that have little to do with how you write most apps and frameworks in mainstream programming languages.
But all great things aside, having Now v2 tied with AWS lambda means I will have to switch to AWS too. I like to stick with one cloud provider and my current favourite is GCP/Firebase, and I will have to weigh out the pro & cons of AWS/GCP again for Now v2. Hopefully in the near future, Now could be cloud provider agonostic
However, it is a very healthy thing to understand the "behind the scenes" in case you need to interoperate with existing APIs or databases[1]
I liked the 1.0 Docker-version and 2.0 feels like a completely different product. Have you considered offering both long-term?
Now offering 1.0 style deployments on an ongoing basis will be helpful.
I trust the leadership at Zeit are making the right decisions technically, but as the company grows, it also seems to get further away from its original mission.
The swift deprecation of previous versions is threatening to undermine any resemblance to the mission, if ease of use is still the mission.
The React team got this so right with the release of hooks in 16.7. Dan couldn't have been any more right on the money in his delivery, which was laden with promises of no breaking changes and "don't feel like you have to rewrite anything."
When Zeit released cloud v2, about three months ago, they made v2 the default, which broke many development workflows and required me personally to spend three full days refactoring code and resolving Docker issues due to an obscure error that Zeit support had trouble identifying. The breaking change was a shock and a surprise. The explanation? You should be doing things this way anyway.
Perhaps that was true, but maybe not.
After going through all the trouble of converting to cloud v2, I reverted to cloud v1 because I could not set the min instances in cloud v2, to eliminate cold boot as an issue. Someone on this thread said cold boot is 200ms. That may be true for a particular application, but I received so many customer complaints about slow boots (5 seconds or more), I had to revert. Reverting has solved the issue.
As of today, I have a deprecation warning when I log into Now which says `Your account is using a legacy platform version. We highly recommend upgrading.` Or what? Are you going to make my unmutable application mutable?
This announcement about Now v2 is confusing, first of all because Zeit already released cloud v2. How are the versions related? Next, serverless may be the future of everything, or it may not work for some existing environments. The jury is out.
To someone at Zeit, please watch the React Hooks Intro video, and the parts of Dan Abraham and Ryan Florence in particular: https://reactjs.org/docs/hooks-intro.html
This is a great way to treat your stakeholders. Also, what helps is that React is going in a direction that focused on simplicity in design. I've experienced the opposite with using Now, but I still love the mission.
And if I want to keep my now 1.0 (or iphone 6 plus) because I prefer it, why do you want to take it away so badly? My complaint is not that you are making improvements. I trust your leadership in this space. You're obviously smart people. The problem is the behavior around deprecating earlier versions. It's herky-jerky and inconsistent.
Also, what is the mission now? That would be great to know.
Congrats on the launch, it looks like a much more cohesive product now!
We agree that invoking entrypoints periodically is a much better way to model most worker / daemon workloads than a "stateful event loop".
The commitment to our customers is that we won't phase out V1 until this usecase (and others!) are thoroughly addressed.
The only tough part is having to delete the old cron instances when I push an update. Scheduled jobs (or some cron support) would be excellent.
https://www.apify.com/docs/actor https://www.apify.com/docs/scheduler
Disclaimer: I'm a co-founder of Apify
For scalability reasons, it's likely you'll want to separate the code that deals with the "request-response" lifecycle from the realtime subscription.
Thanks!
There is still a cloud provider which is manifestly a server; that's why this buzzword is stupid.
It completely takes away the pain-points of setting up and managing the cloud infrastructure directly.
From what I got to see, it is really cool!
Serverless is still bad for modern web apps, that serve HTTP requests to real people..
I know that from practice, running Next.js & a GraphQL backend on AWS lambda.
Many devs think, that the infamous "cold start" problem is easily solved by:
"Warm" keeping (keeping a number of functions "warm" 24x7).
Cold start times getting below a certain level, the often cited < 300ms.
Both solutions currently fail to address the problem.
Let's say you keep 5 functions "warm". Of course the first users will not suffer from cold starts. But then, if you get a large number of almost simultaneous requests (a burst).
A certain number of users will get immediate responses, as they are handled by warm functions. But another set of users will experience far worse response latencies, as lambda functions were spun up, for every additional request coming in, while the warm functions were occupied.
While spinning up new servers is definitely slower, the total wait time in the classical server model, under heavy load, is equally distributed among all users of your app, so everyone sees it perform "a bit slower".
In the serverless model, on the other hand, some users will enjoy the immediate response time, while others will have horrible response times (especially taking additional latencies into consideration, see below). And they will leave your website within those 3 seconds.
For most commercially successful websites, increased latency is far more expensive, than some additional scaling cost. Everyone coming to our app is worth a lot of $$$, as we had to spend a lot of $$$ to get her here. One should consider that, when discussing scaling considerations. I think most people know the famous Amazon study, of 100 ms === -1% in sales. So if you try to argue about scaling cost, please keep your Google AdWords bill close.
Keeping functions warm also feels like the stone age. You're basically just pinging the thing all the time. People are seriously talking about pint-time-distribution-algorithms on Medium, i.e. how often, and at what time deltas you need to ping the thing, to hope that e.g. AWS Lambda is keeping a certain number of functions warm for you. Feels like a mysterious hack to me.
Now, let's debunk this naive latency argument. (I was sold on that, too before i ran a real life app on it).
Obviously you're not using a huge monolith, splitted your app in services, at least backend & frontend. Now, take a look at our user case.
Client →
→ Next.js Frontend (Lambda with Node.js)
→ GraphQL Server (Lambda with Node.js)
→ Prisma GraphQL Server (Lambda with the JVM)
→ Some managed database at GCP or AWS
See the problem? You don't have ONE cold start time. You might have THREE.
And don't forget, this is just additional time added to the:
Request handling time + database calls + data center latencies + client location latency + low client bandwith. This is why you can read comments here, that real people are waiting 5 sec for your page to load.
Also: The < 300 ms is just a best case scenario, that works for Node.js apps. Try to put a JVM app into the chain app (like e.g. Prisma GraphQL which runs on Scala). The results will be far worse.
That's also why the term "global deployments" is just a nice buzz word. Never forget to keep all your stuff in the same datacenter. You can't abstract away physics. You need to know or make educated guesses, who really owns these Zeit datacenters. If you read "Brussels", get your database at Google. If it's SFO, it might be better AWS..
If you're running GraphQL servers with subscriptions, or any other keep alive connections, beware of other issues with Lambda.
We were planning to use Zeit Now for our whole app infrastracture, besides the DB, which was supposed to be managed by Google or AWS.
We were doing serverless and running on AWS Lambda & Now before. And we were facing severe issues with AWS Lambda: Massive problems with cold starts, with user request bursts (e.g. someone posts an article about your app or after running a TV commercial)
While i try to "embrace" Lambdas that, i must admit, appeal to me from a dev experience viewpoint, i'm losing $$$ and FAR WORSE, providing a bad experience to my users.
Congrats!