
Build a serverless app with a serverless database - evanweaver
https://fauna.com/blog/serverless-cloud-database?yc
======
endymi0n
2018 will be so awesome when apps start to become clientless as well...

~~~
j_s
SMS chat bot! Actually, a growing category... :)

~~~
earleybird
Y(SMS chat bot)

------
ge96
I still don't get how you can store something without putting it anywhere.
It's just "in transient" like electricity in a superconductor closed coil?
hahaha

Not doubting it I just don't understand. Unless you're storing through "cache"
client-side or direct RAM I don't know.

~~~
nbclark
Serverless just means not hosting your own infrastructure + boxes. Amazon
Lambda is a good example where you run arbitrary script on their
infrastructure on demand, without having always-available servers.

~~~
altern8tif
I find the term "serverless" quite misleading. Essentially, all the code in
the world has to run on a machine so there is nothing really "server-less"
about it.

It's probably more accurate to say something like "devops-free" since
management of servers is hived off to a third party. Sounds less buzz-worthy,
so maybe someone can come up with something better.

------
evanweaver
In case you are wondering what fauna is in general, it's an object-relational,
temporal, geographically distributed, strongly consistent, multi-tenant, QoS-
managed operational database. It's implemented on the JVM and queried via
type-safe embedded DSLs like LINQ.

~~~
crestedtazo
Is there any way for me to contribute money or other donations to your
project? Good on you for making your dreams a reality.

~~~
evanweaver
You can use the database, and eventually we will send you a bill for your
usage. :-)

~~~
nickpsecurity
It worked for IBM. It then worked for Amazon. It worked for AT&T GoPhones. It
can work for you, too. :)

------
marknadal
Somebody else asked this, but the answer got distracted onto (reasonably so)
the CAP Theorem.

What is the difference between Fauna and DynamoDB? Especially since the
article swaps them out (and explains the API differences).

DynamoDB is going to be having a replica you can read from within physical
milliseconds of your lambda function (serverless is such a bad name, makes me
think of P2P, anyways...) while it seems like Fauna is gonna have to make
network calls out to your service...

Which when you pay per time with lambda, and you want lambda functions to be
fast anyways, I don't see the point of Fauna? Note: I'm not saying Fauna is
bad, it seems like a cool idea, but I'm not understanding how it is a superior
alternative.

So lets say you don't want to pay for DynamoDB, it still seems like you'd be
better off running something like a pure NodeJS database like Parse's open
source server or [https://github.com/amark/gun](https://github.com/amark/gun)
, either inside the lambda function directly or connecting to it (since it'll
be on a nearby machine in AWS)?

~~~
evanweaver
FaunaDB is hosted in several AWS regions around the world, so the latency is
similar to DynamoDB if you're colocated. We will expand to more AWS regions
and other cloud providers soon.

The biggest operational difference between FaunaDB and DynamoDB, aside from
being globally distributed, is that you don't have to pre-provision capacity
in FaunaDB. DynamoDB requires you to provision capacity per table and you have
to pay for whatever you don't use. If you go over the provisioned capacity
your app stops working. FaunaDB is delivered like a utility; you just pay as
you go.

Also FaunaDB supports joins, transactions, unique indexes, views, etc., and
you can install it on-premises if you want.

~~~
marknadal
Thanks for the answer!

------
simplify
What's the difference between "serverless" and "cloud"?

~~~
pavlov
It's analogous to "functional" and "object-oriented". They're both popular
buzzwords. One has been beaten to death and sometimes implemented poorly
enough to gain a bad rap. The other is still new enough to serve as a vessel
for software people to pour in all their vague hopes and unrealistic dreams.

At some point, the new hotness will be the old tiredness, and the cycle will
repeat.

~~~
Gaelan
I'm honestly sure which description refers to functional and which refers to
OOP. They fit equally well.

------
falcolas
What's the difference between this and AWS' DynamoDB, or Aurora if you prefer
RDBMS? A HTTP endpoint as the DB API? Seems like a lot of extra overhead,
unless you're hosting a "client-only" webapp (which would previously have used
Firebase, IIRC).

Also, this confuses me:

> FaunaDB can tolerate the loss of a minority of physical datacenters in a
> cluster without interruption. According to the CAP theorem, FaunaDB is a CP
> system.

CP means that consistency is favored over availability, yet "without
interruption" tells me they favor availability over consistency during a
partition.

~~~
prodigal_erik
If a partition leaves a quorum in contact with each other, why would it cause
an interruption? CP means nodes not within a quorum become unavailable, and if
a quorum no longer exists the whole system is unavailable. AP means minorities
stay available at the risk of inconsistency.

~~~
falcolas
> If a partition leaves a quorum in contact with each other, why would it
> cause an interruption?

You can have a split that still has a group of machines with quorum: a 3/2
split would leave three nodes with quorum, and two without.

Clients which attach to the non-quorum machines would lose the ability to read
or write if it's CP, yet the clients connected to the quorum machines would
retain the ability to read and write. So it would be a partial outage, until
some way is found to identify quorum members and route clients back to that
quorum (making the assumption that clients could talk to any node in a
partition).

------
jchrisa
If you want to skip directly to running code, these instructions (linked from
the article) should get you to hello world.
[https://github.com/fauna/serverless-
crud#installation](https://github.com/fauna/serverless-crud#installation)

------
RubyPinch
I really wonder what possesses people to use pullquotes

    
    
        WHAT POSSESSES PEOPLE
        TO   USE   PULLQUOTES
    

Its like they don't trust you to read a couple of sentences or something

~~~
chc
A couple of reasons:

1\. They _don 't_ trust people to read everything. A lot of readers drop off
before the end of an article just because their attention flits away. Pull
quotes are a way of saying, "Here's something coming up that I think is
interesting. If you are interested, you should keep reading."

2\. A lot of people have trouble with long runs of samey text. Some see it as
boring, others as imposing, others as hard to navigate, but for whatever
reason, long runs of text are simply hard to read for a lot of people. So pull
quotes are a way to break up the text without resorting to vaguely relevant
cat pictures.

~~~
RubyPinch
> "Here's something coming up that I think is interesting. If you are
> interested, you should keep reading."

But nearly no one ever uses it to refer to what is coming up, its almost
always what has just happened 1 sentence ago.

> A lot of people have trouble with long runs of samey text.

nothing is more samey than repeating the same sentence!

pull quotes like how this article has,punishes the user for reading the
article word for word. There are other methods that have the pull quotes
outside of the flow!

And if it is a really important sentence, then throw some slight yellow
background on the text or something, like a highlighter!

~~~
chc
> _But nearly no one ever uses it to refer to what is coming up, its almost
> always what has just happened 1 sentence ago_

That's true if you read them inline, but pull quotes are generally presented
in a large font so that you can see them without having actually read the
accompanying text yet.

> _pull quotes like how this article has, punishes the user for reading the
> article word for word, There are other methods that have the pull quotes
> outside of the flow, which I personally would prefer!_

I agree with that. The pull-quotes on this site are poorly designed and really
hurt the flow of the article.

------
Gys
I understood that Lamda just freezes the code between calls. So any connection
to a database just continues when the next call comes in. Only problem might
be the server time-out for the connection if the time between calls is longer.

I never tried (yet) but if I need something like Fauna then my assumption was
wrong ?

------
powera
This is a prime example of where "serverless" means "someone else's server".

~~~
weberc2
When has it ever meant anything else? P2P?

~~~
alisson
The first time I read the word "serverless" I immediately related it to P2P

------
mankash666
Is this DB ACID compliant? This is a major omission from the article, as I was
considering this as a replacemnt for PostGres SQL As-A-Service offerings.

~~~
jchrisa
Yes. We offer global acid transactions using the Calvin protocol.
[http://cs.yale.edu/homes/thomson/publications/calvin-
sigmod1...](http://cs.yale.edu/homes/thomson/publications/calvin-sigmod12.pdf)

------
nathancahill
Sounds awfully like a server to me.

------
brilliantcode
I was initially overly excited by AWS Lambda + API Gateway but now looking at
the costs it's _cheaper_ and less overhead to just run a highly available
boxes.

For large organizations, I can see the benefit of moving to serverless
particularly doing away with server ops for more slower and less frequent
tasks..

but for fast response and cost effectiveness, unless AWS Lambda dramatically
reduces costs to match a $5 / month digitalocean instance that will respond
instantly and can take quite a beating for lighter requests, I'd be more wary-
AWS bills can rack up very fast.

~~~
skrowl
Lambda cold start time for a .NET app that made a SQL connection and then did
a simple count command was multiple seconds. Not useful for production.

~~~
abrookewood
That totally depends on what you are doing. We use Lambda to generate
thumbnails of documents that are uploaded to one of our applications. I can
throw 600-800 pages at it and because it calls a Lambda function per page, the
whole thing finishes in less than 10 seconds. No need to scale instances and
no need to worry about running out of RAM on our servers. The cold start also
gets less after the initial run.

~~~
skrowl
Yeah. I could see it for batch processing. It's just not suitable for real
time / API work that I was hoping to use it for.

~~~
abrookewood
Yes, it's not necessarily going to work for things like that - the start up
time alone would make it useless.

------
GiorgioG
Meh - led by a couple of ex-Twitter infrastructure guys. No thanks.

~~~
tschellenbach
Twitter is possibly one of the hardest sites to scale out there. Sure they had
their share of the fail whale but can you blame them?

~~~
evanweaver
You can read a little bit about our Twitter experience here:
[https://fauna.com/blog/welcome-to-the-jungle](https://fauna.com/blog/welcome-
to-the-jungle) Twitter still uses the social graph and timeline databases we
built years and years ago.

