Settings

Theme

ReadySet Core: next-generation SQL caching, freely available

readyset.io

106 points by marzoeva 4 years ago · 58 comments

Reader

aeyes 4 years ago

If you release something new, you should make sure that your documentation contains useful information.

Even the most fundamental information like available configuration options, command-line arguments, deployment information and so on is missing.

Looking at the code it appears that you need Consul, Zookeeper and Redis to make this fly and the docs don't mention this anywhere. They (barely) explain how to run the SQL proxy on a local machine but thats it.

I wonder if the testimonials on your website are just pulled from thin air, I don't think any sane person would even experiment with this anywhere near production environments.

  • greg-m 4 years ago

    Hey, PM @ ReadySet - fair points, and thanks for checking us out.

    We've been in pretty heavy development and have been heads down on getting ReadySet into your hands as quickly as we could. We'll be doing a major documentation pass soon which will have more info about clustering, etc.

    There's also a bit more detail in our development guide - see https://github.com/readysettech/readyset/blob/main/developme...

  • latchkey 4 years ago

    From the blog post "Rather than forcing developers to switch to a key-value store"...

    > need Consul, Zookeeper and Redis to make this fly

    A hard dependency on 3 key value stores?

    • marzoevaOP 4 years ago

      We need either Consul or Zookeeper (for leader election). No dependency on Redis!

      That part of the blog post refers to ReadySet having a SQL interface, rather than a key-value one.

      • cpursley 4 years ago

        Elixir/Erlang is not the most memory efficient, but it could be used for something like this without the need for Redis for Consul/Zookeeper.

zasdffaa 4 years ago

There are too many questions here. What does it not do? What's the overhead of monitoring the main DB and how's it done - triggers? Does it need schema changes? What about race conditions - can you guarantee none? What's the memory overhead you need for the cache? Can you control what gets cached?

> It can serve millions of reads per second on a single node ...

I'm not a network guy but that seems just astonishing - what is a 'node' here?

> ReadySet incrementally maintains result sets of SQL queries based on writes to the primary database.

So basically you've solved the general materialised view incremental update problem? That's an unsolved problem in general, surely?

Edit: not dissing but trying to see where the limits are.

  • umanwizard 4 years ago

    > That's an unsolved problem in general, surely?

    It's not. Materialize (my employer) incrementally maintains views too, using tech (Differential Dataflow) that has existed for almost 10 years: https://cs.stanford.edu/~matei/courses/2015/6.S897/readings/... .

    ReadySet is based on Noria (Jon Gjengset's Ph.D thesis, explained for non-experts here: https://jon.thesquareplanet.com/noria-in-simpler-terms.pdf).

    Taking a research project and making it into a production-ready product is hard work -- congrats to the ReadySet team on the launch, and best of luck!

    • zasdffaa 4 years ago

      We may be talking very different things. From the postgres docs, a sample materialised view <https://www.postgresqltutorial.com/postgresql-views/postgres...> (I did a few tweaks as marked)

         CREATE MATERIALIZED VIEW rental_by_category
         AS
         SELECT c.name AS category,
           sum(p.amount) AS total_sales
          FROM (((((payment p
            JOIN rental r ON ((p.rental_id = r.rental_id)))
            JOIN inventory i ON ((r.inventory_id = i.inventory_id)))
            JOIN film f ON ((i.film_id <> f.film_id)))  -- tweak
            JOIN film_category fc ON ((f.film_id = fc.film_id)))
            JOIN category c ON ((fc.category_id < c.category_id)))  -- tweak
         GROUP BY c.name
         HAVING sum(p.amount) NOT IN (196, 203, 791)  -- tweak
         ORDER BY sum(p.amount) DESC
      
      It can materialise and efficiently (read: incrementally) maintain the result set of that??
      • umanwizard 4 years ago

        I believe the non-equijoin will cause problems for Materialize today (I don’t work on our optimizer team, so I’m not 100% sure and don’t take this as authoritative). We might turn that into a cross join followed by a filter.

        I will answer that for sure later today when I’m back at my desk.

        If you changed that back to an equals sign, yes, we could incrementally maintain your query.

        • zasdffaa 4 years ago

          Thanks. I'd be very interested.

          I originally had added the HAVING clause to nastify it further, because this would cause values to appear and disappear, so to handle that you (probably?) have to materialise the entire result of the GROUP BY before applying a HAVING. Which is doable could cause some overhead.

          I guess I could see it work for INSERT-only tables, with a lot of headache, but throw in UPDATE and DELETE and it could become awful.

          Also we have to agree on what 'incrementally' means :)

          • umanwizard 4 years ago

            Updates and deletes work fine, because Differential Dataflow stores everything as a (row, timestamp, cardinality) tuple. Materializes uses signed integers as its cardinality type. Thus deletes are modeled as (“the row”, t2, -1), which will cancel out with (“the row”, t1, +1), and thus nothing will be returned for that row when the view is queried at any time >= t2. Eventually compaction will cause these cancelled rows to be annihilated entirely and so there will be no lingering space impact.

          • umanwizard 4 years ago

            I checked the plan. This will involve a cross join, and maintaining the entire result of the group by before the having (the former could possibly be avoided with some future work in Materialize to allow range queries; the latter is probably essential). Without your tweaks, the only required state is the join indexes.

  • trollied 4 years ago

    Oracle has had MVs that can refresh on update for decades.

    • zasdffaa 4 years ago

      So does Pgres & mssql, but general views that are incrementally updated - that's another matter. I'd be very surprised (and pleased).

      • marzoevaOP 4 years ago

        This is indeed our goal– we're most of the way there with SQL 92 and plan to continue to expand our query support over time!

jjice 4 years ago

I love the concept. Not needing to have extra code and logic for a caching layer seems very nice. In my experience, I haven't ever been in a situation where I needed super heavy caching, but this seems like it gives it to you "for free". Interested to see if we see more of ReadySet in the future.

cpursley 4 years ago

Woah, I had the same idea not so long ago. Right now I'm using GraphCDN but would much rather cache at the database level. Looks like this could be a drop in for lots of people already on Postgres & MySQL (meaning no more dog-slow Rails apps).

There was a cool article about intercepting the Postgres connection with Elixir not long ago: https://docs.statetrace.com/blog/build-a-postgres-proxy/

steve-chavez 4 years ago

How does ReadySet interact with Row level security[1]? For RLS to work you'd need validation at the origin server anyway right?

[1]: https://www.postgresql.org/docs/current/ddl-rowsecurity.html

  • zasdffaa 4 years ago

    Damn, that's a good question! Or security in general. But I wouldn't blame them at all if they didn't do it. Good thought though.

freitasm 4 years ago

Interesting. I would love to see this available for MS SQL Server.

I've played with Safepeak (1) which runs on Windows Server. It was sold later to an Israeli company (2), which have since gone out of business and assets ended up with another company and now sold as ScaleArc (3)

The original SafePeak is available free but no maintenance or anything, so not really production ready. It works, as tested in a test environment but eight years without support or updates...

(1) http://www.safepeak.org/ (2) https://en.wikipedia.org/wiki/SafePeak (3) https://www.devgraph.com/scalearc/

xtreak29 4 years ago

GitHub repo : https://github.com/readysettech/readyset

agacera 4 years ago

This looks really nice. I was reading about this and realized it had similar ideas to this [1] Phd thesis from Jon Gjengset. I checked his twitter [2] and it was based on his work indeed.

Great that someone is productionalizing this!

Btw, is Jon involved in ReadySet?

[1] Partial State in Dataflow-Based Materialized Views - https://github.com/mit-pdos/noria

[2] https://twitter.com/jonhoo/status/1537474261689872384

_ben_ 4 years ago

PolyScale [1] is a serverless plug-and-play database edge cache. Our goal is for devs to be able to scale reads globally in a few minutes. It’s wire compatible with Postgres, MySQL, MS SQL Server (more coming including no-sql).

It has a global edge network, so no infrastructure to deploy and AI managed cache and auto invalidation, so no cache configuration needed.

[1] https://www.polyscale.ai/

trollied 4 years ago

> ReadySet is a lightweight SQL caching engine that precomputes frequently-accessed query results and automatically keeps these results up-to-date over time as the underlying data in your database changes

I don't see the point in using an extra app - you can do this natively in Postgres. Materialized views. https://www.postgresql.org/docs/current/rules-materializedvi...

  • hbrundage 4 years ago

    Postgres materialized views have to be manually refreshed on a schedule, and so are always out of date, whereas ReadySet keeps your results up to date automatically as the input changes. For PG materialized views, the compute required proportional to the size of the input data, and is paid every time, whereas with ReadySet the computation is incremental, so it's proportional to the size of the change in the data over time.

    And finally, ReadySet's (Noria's) big innovation is that the result set can be only partial, storing only the elements of the result set (and underlying data flow graph) that are frequently accessed, instead of the whole result set like a materialized view would.

  • adwf 4 years ago

    Except then you need to be paying someone to monitor your queries and develop your views rather than just dropping a container in the middle with this app.

  • cpursley 4 years ago

    Are materialized views aware of applied where filters?

tmikaeld 4 years ago

> Traditional databases would compute the results of this query from scratch every time it was issued.

Is this really the case that queries can't be cached on traditional databases?

d_watt 4 years ago

Interesting. What would you say the use case is for this, rather than setting up read replicas? Not having to maintain routing to the replicas on the application side?

  • _jezell_ 4 years ago

    When you care about perf a lot more than consistency

    • marzoevaOP 4 years ago

      Hi! CEO of ReadySet here. You can think of ReadySet as being a cross between a traditional read replica and a custom caching layer (e.g. one you might build on top of Redis). With read replicas, you still rerun queries from scratch every time they're issued, which means you still have to think about things like query optimization. ReadySet caches frequently run queries in memory so you get super-fast query latencies on cache hits. Because of this, you can scale to much higher read throughputs without extra effort. This is especially useful for read-heavy applications (e.g. websites, certain types of dashboards, among others!)

      You can read more about how it works here: https://docs.readyset.io/concepts/overview

      • jinjin2 4 years ago

        How do you deal with security? In modern databases like MongoDB permissions are granular down to the field level.

        The same query could produce wildly different result based on the user issuing them, and the caching somehow has to take that into account. Is that something you address?

anentropic 4 years ago

Seems clever!

I'm curious what might be pathological cases, patterns of query watching and updates that give the cache a lot of work to do to keep up

wasd 4 years ago

I signed up for the waitlist! I noticed it asked about AWS, Azure, and GCP but we use Heroku. Hopefully, that won't put me too low on the list.

Do you have a sense for when people can try it? Most of our app is reads and we're using Rails + Redis and it's fine and sometimes a pain. Would love to try it.

  • greg-m 4 years ago

    Hey, PM @ ReadySet here. Shoot an email to greg@readyset.io and we can see what we can do :)

pmarec 4 years ago

Are you looking into spreading the dataflow even more down to the clients ? Think realtime subscription for complex queries over structured data.

  • greg-m 4 years ago

    Yes! We've thought about this in depth and have some ideas but I'd love to chat more. Shoot me an email: greg@readyset.io

pmarec 4 years ago

I seems like i need an @readyset.io address to join your slack. Do you confirm ?

jensneuse 4 years ago

BSL :(

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection