3,589 karma · joined December 8, 2009
It would make more sense as a collection of plugins, and perhaps exposed as a preset.
But the intent is to precisely remove the extra setup, when all you need to do is publish your Node.js codebase as a single file.
However, this is not the case for all databases. Furthermore, modern database vendors are extremely motivated to address the serverless usecase
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]
As a matter of fact, this is an example of executing `now --regions all` :)
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.
For scalability reasons, it's likely you'll want to separate the code that deals with the "request-response" lifecycle from the realtime subscription.
It completely takes away the pain-points of setting up and managing the cloud infrastructure directly.
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.
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.
Surely, some code changes are necessary to go serverless (when considering legacy servers and apps), but our goal is to always minimize that.
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.
Some small adjustments will be necessary when _importing_ large legacy codebases, but that's where using functions to also build your project comes in!
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.
We picked video/gif as the delivery format to give people a real-life impression of performance. (I took the videos myself while using the platform on a regular production plan.)
The crucial difference is that the activation cost of booting up a full OS (like Windows 2000) is massive (typically involving a chain-reaction of CPU and IO-intensive init services), whereas that is not the case for our serverless infrastructure.
What you do point out is one of the most important engineering challenges we had to solve (and continue to be focused on).
[One of the differences is performance. You'll find that we can build and execute much more quickly :)]
There are many examples here: https://github.com/zeit/now-examples
We like and use CosmosDB because it fits this criteria. We anticipate that Google Spanner, CockroachDB and similar databases will become the go-tos in combination with ZEIT Now.