Redis 16 times faster than Postgres?

Started by Colin 't Hartover 6 years ago12 messagesgeneral
Jump to latest
#1Colin 't Hart
colinthart@gmail.com

Hi,

Can someone take a look at this blog post?
https://www.peterbe.com/plog/redis-vs-postgres-blob-of-json

Can Redis really be 16 times faster than Postgres? Surely Postgres can get
closer to the raw speed of the hardware than 1 order of magnitude?

Thanks,

Colin

#2Nathan Woodrow
madmanwoo@gmail.com
In reply to: Colin 't Hart (#1)
Re: Redis 16 times faster than Postgres?

Redis is a in memory database so I would except it to be always much
faster..

On Mon., 30 Sep. 2019, 7:42 am Colin 't Hart, <colinthart@gmail.com> wrote:

Show quoted text

Hi,

Can someone take a look at this blog post?
https://www.peterbe.com/plog/redis-vs-postgres-blob-of-json

Can Redis really be 16 times faster than Postgres? Surely Postgres can get
closer to the raw speed of the hardware than 1 order of magnitude?

Thanks,

Colin

#3Ron
ronljohnsonjr@gmail.com
In reply to: Colin 't Hart (#1)
Re: Redis 16 times faster than Postgres?

On 9/29/19 4:42 PM, Colin 't Hart wrote:

Hi,

Can someone take a look at this blog post?
https://www.peterbe.com/plog/redis-vs-postgres-blob-of-json

Can Redis really be 16 times faster than Postgres? Surely Postgres can get
closer to the raw speed of the hardware than 1 order of magnitude?

Redis is an in-memory key-value database. PostgreSQL... isn't.

--
Angular momentum makes the world go 'round.

#4Morris de Oryx
morrisdeoryx@gmail.com
In reply to: Ron (#3)
Re: Redis 16 times faster than Postgres?

Sigh. I despair of "16x faster" and "20x faster" headlines that ignore the
raw numbers. *The worst numbers in there are far below the threshold of
user perception*. Unless these results are compounded by running in a loop,
they are meaningless. Not immeasurable, just meaningless.

https://www.nngroup.com/articles/response-times-3-important-limits/

That piece is from 1993, but the human nervous system hasn't changed since
then.

#5Ron
ronljohnsonjr@gmail.com
In reply to: Morris de Oryx (#4)
Re: Redis 16 times faster than Postgres?

On 9/29/19 7:01 PM, Morris de Oryx wrote:

Sigh. I despair of "16x faster" and "20x faster" headlines that ignore the
raw numbers. *The worst numbers in there are far below the threshold of
user perception*. Unless these results are compounded by running in a
loop, they are meaningless. Not immeasurable, just meaningless.

https://www.nngroup.com/articles/response-times-3-important-limits/

That piece is from 1993, but the human nervous system hasn't changed since
then.

Back-end web servers don't have human nervous systems. Faster response time
means that a give bit of hardware can support a much higher load, saving you
money

--
Angular momentum makes the world go 'round.

#6Morris de Oryx
morrisdeoryx@gmail.com
In reply to: Ron (#5)
Re: Redis 16 times faster than Postgres?

Back-end web servers don't have human nervous systems. Faster response

time means that a give bit of hardware can support

a much higher load, saving you money

Fair point, I can't argue against it as stated. Although I have no way of
know if this person's site is *ever* overloaded or has any chance of saving
money. Other sites do for sure. Not knocking using in-memory caches, they
can be a life-saver.

Like everyone else here, I've been to a *lot* of meetings down the year
that came down to arguing about optimizations that could not pay for
themselves before the heat death of the universe. As such, I've developed
an allergy to context-free performance comparisons.

On Mon, Sep 30, 2019 at 10:25 AM Ron <ronljohnsonjr@gmail.com> wrote:

Show quoted text

On 9/29/19 7:01 PM, Morris de Oryx wrote:

Sigh. I despair of "16x faster" and "20x faster" headlines that ignore the
raw numbers. *The worst numbers in there are far below the threshold of
user perception*. Unless these results are compounded by running in a
loop, they are meaningless. Not immeasurable, just meaningless.

https://www.nngroup.com/articles/response-times-3-important-limits/

That piece is from 1993, but the human nervous system hasn't changed since
then.

Back-end web servers don't have human nervous systems. Faster response
time means that a give bit of hardware can support a much higher load,
saving you money

--
Angular momentum makes the world go 'round.

#7Steve Litt
slitt@troubleshooters.com
In reply to: Nathan Woodrow (#2)
Re: Redis 16 times faster than Postgres?

On Mon, 30 Sep 2019 07:46:14 +1000
Nathan Woodrow <madmanwoo@gmail.com> wrote:

Redis is a in memory database so I would except it to be always much
faster..

Is there a way to have Redis periodically update an on-disk backup?
That would be great, but otherwise you're at the mercy of your power
company (here in Central Florida it's routine for power to go down and
stay down for five hours).

SteveT

Steve Litt
Author: The Key to Everyday Excellence
http://www.troubleshooters.com/key
Twitter: http://www.twitter.com/stevelitt

#8raf
raf@raf.org
In reply to: Steve Litt (#7)
Re: Redis 16 times faster than Postgres?

Steve Litt wrote:

On Mon, 30 Sep 2019 07:46:14 +1000
Nathan Woodrow <madmanwoo@gmail.com> wrote:

Redis is a in memory database so I would except it to be always much
faster..

Is there a way to have Redis periodically update an on-disk backup?
That would be great, but otherwise you're at the mercy of your power
company (here in Central Florida it's routine for power to go down and
stay down for five hours).

SteveT

Steve Litt
Author: The Key to Everyday Excellence
http://www.troubleshooters.com/key
Twitter: http://www.twitter.com/stevelitt

i don't know but voltdb, another in-memory database,
replicates to other instances which can be in different
geographical locations and so not prone to a single
power failure. perhaps all in-memory databases are
aware of the need for this.

cheers,
raf

#9Ron
ronljohnsonjr@gmail.com
In reply to: Steve Litt (#7)
Re: Redis 16 times faster than Postgres?

On 9/29/19 8:09 PM, Steve Litt wrote:

On Mon, 30 Sep 2019 07:46:14 +1000
Nathan Woodrow <madmanwoo@gmail.com> wrote:

Redis is a in memory database so I would except it to be always much
faster..

Is there a way to have Redis periodically update an on-disk backup?
That would be great, but otherwise you're at the mercy of your power
company (here in Central Florida it's routine for power to go down and
stay down for five hours).

It would be criminal for it not to have an async writer process flushing
modified pages to disk.  And to not have a UPS that you've tested.

--
Angular momentum makes the world go 'round.

#10Michael Paquier
michael@paquier.xyz
In reply to: Ron (#3)
Re: Redis 16 times faster than Postgres?

On Sun, Sep 29, 2019 at 04:52:15PM -0500, Ron wrote:

On 9/29/19 4:42 PM, Colin 't Hart wrote:
Redis is an in-memory key-value database. PostgreSQL... isn't.

Well, I think that you have never heard about the urban legend of
running Postgres on scissors then and this reminds me of this blog
post:
http://www.databasesoup.com/2015/02/running-with-scissors-mode.html

Note that sometimes I have run Postgres on a tmpfs as well to test
some specific patches. So that can be done, and of course that's
unsafe.
--
Michael

#11Ben
bench@silentmedia.com
In reply to: Ron (#9)
Re: Redis 16 times faster than Postgres?

On Sep 29, 2019, at 8:44 PM, Ron <ronljohnsonjr@gmail.com> wrote:

On 9/29/19 8:09 PM, Steve Litt wrote:

On Mon, 30 Sep 2019 07:46:14 +1000
Nathan Woodrow <madmanwoo@gmail.com> wrote:

Redis is a in memory database so I would except it to be always much
faster..

Is there a way to have Redis periodically update an on-disk backup?
That would be great, but otherwise you're at the mercy of your power
company (here in Central Florida it's routine for power to go down and
stay down for five hours).

It would be criminal for it not to have an async writer process flushing modified pages to disk. And to not have a UPS that you've tested.

It's perfectly reasonable to use Redis as a caching layer without any persistence at all. In such cases, flushing state to disk is a waste of resources.

(For other use cases, yes, Redis allows you to flush state to disk.)

#12Imre Samu
pella.samu@gmail.com
In reply to: Colin 't Hart (#1)
Re: Redis 16 times faster than Postgres?

from the original article:

For example, the PostgreSQL speeds depend on the Django ORM code
that makes the SQL and sends the query and then turns it into the model

instance.

I don't know what the proportions are between that and
the actual bytes-from-PG's-disk times. But I'm not sure I care either.

imho: the "Django ORM" is not so fast.
according to "TechEmpower Web Framework Benchmarks" ...
it has only ~3% performance - compare to the best rust+pg (100%) results.

example:
"Data updates"
https://www.techempower.com/benchmarks/#section=data-r18&amp;hw=ph&amp;test=update
the "django-postgresql" performance = 766 - only 3.0% of the best pg +
rust results
checking the other test types ( "Single query" ;" Multiple queries" ) has
a similar results.

the Django implementation of the test:
https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Python/django

Imre

Colin 't Hart <colinthart@gmail.com> ezt írta (időpont: 2019. szept. 29.,
V, 23:42):

Show quoted text

Hi,

Can someone take a look at this blog post?
https://www.peterbe.com/plog/redis-vs-postgres-blob-of-json

Can Redis really be 16 times faster than Postgres? Surely Postgres can get
closer to the raw speed of the hardware than 1 order of magnitude?

Thanks,

Colin