HNHacker News
TopNewBestAskShowJobs

eventreduce

114 karma · joined April 12, 2020

submissionscomments
eventreduce··on V8 Release v9.4
With real private fields you can make a minifier that minifies the fieldname/functionname which is not possible before.
eventreduce··on Reinvented wind turbine generates five times more energy than its competitors
It has like 100 times more moving parts that can break.
eventreduce··on It’s time to move your applications to Java 17. Here’s why. And here’s how
Because you can make good money by migrating the customers java project once each year.
eventreduce··on Stop Death Shaming
Most people do not "deserve" bed space because most sickness is selfmade. People smoke, drink and eat too much, so they all deserve to die?
eventreduce··on Why query planning for streaming systems is hard
You should check out the event-reduce algorithm[1]. It scales in a different way on how it calculates new results based on old-Results+Event. So it can have some benefits over materialized views depending on the data size and how many clients subscribe to a query.

[1] https://github.com/pubkey/event-reduce

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
It sounds like you did not read the READme. What you are describing is something that does scale up with more data but not with more requests. When you have an application where 1000s of users subscribe to different queries, your view-maintainance would kill the write performance while EventReduce does not.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
The difference is that with simple caching you have to run full queries again when the cache becomes invalidated. This is often expensive especially on write intensive data usages.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
I think the best example for why this is useful is described by david glasser at his talk about the oplog driver used in meteor.js https://www.youtube.com/watch?v=_dzX_LEbZyI
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
All your assumptions are wrong. Please read the other comments here or at least the readme of the repository. I will happily answer all ongoing questions you have afterwards.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
No and I also do not want to "claim" something. Feel free to do your own tests.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
EventReduce is a simple algorithm. It does not care or affect how you handle propagation of writes or how you handle your events, transactions or conflicts.

See it as a simple function that can do oldResults+event=newResults like shown in the big image on top of the readme.

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
I recommend the video "Real-Time Databases Explained: Why Meteor, RethinkDB, Parse & Firebase Don't Scale" https://www.youtube.com/watch?v=HiQgQ88AdYo
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
EventReduce is an algorithm and not a database-wrapper. It will not care about your writes or if your database layer is a cluster and so also not affect them.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
I encourage you to read the readme and check out the demo. EventReduce is nothing magically drills out your database and affects the consistency of your write-accesses.

It is a simple algorithm that is implemented as a function with two inputs and one output.

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
I understand that reading the plain source code is more painful then reading a paper.

There are many different trade-offs between a paper and the current repository with source code. For me the biggest argument was that EventReduce is a performance optimization. So to be sure if it really works and is faster, you always need an implementation since you cannot predict the performance from a paper.

Because I did not have time for both, I only created the repository with the implementation. Maybe a paper will be published afterwards.

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
localStorage is no database, check out the demo page.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
You have to provide the events by yourself. See EventReduce as a simple function that can do oldResults+Event=newResults.

And yes, you should always do testings before you use open source stuff. There is no warranty use it on your own risk.

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
Yes I used it. I actually know it really well. I also did performance comparisons with mongodb and mongodbs change stream and cursors. What I posted here is just an algorithm. You could now compare it to mongodb (a product) and say it is a "more flexible solution" but I do not see the point in directly comparing it simply based on the documentation of both.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
I think it is dangerous to propose a database product as a solution to the limitation of a simple algorithm.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
Thanks that looks interesting. I added it to my to-read list.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
The biggest usecase for EventReduce is realtime applications. Most technologies for these like Firebase, AWS AppSync etc. work on non-relational data. If you want to use EventReduce with relational queries, you have to make them non-relational before, for example by using materialized views. If you do not want to do that, you should not use this algorithm in its current featureset.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
This is a great question. So EventReduce is only the algorithm that calculates your new results. The parsing of SQL is not done by it, you have to bring it by yourself. This works over providing some information about the query like Sort-fields and query-matchers. This is described good in the JavaScript implementation [1]. Providing this functions works easy for NoSQL-Queries because they are better composable. For SQL-queries you have to do some work before you can use EventReduce.

Also see the limitations of EventReduce in the readme.

[1] https://github.com/pubkey/event-reduce/tree/master/javascrip...

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
There is a big difference between a change-stream and a realtime query. For example mongodbs cursor-stream is a good way to observe the events that happen to a specific collection or documents that match some criteria. If you want the realtime-results of a query that has sorting, skip limit etc. than it is really hard to warp the changestream into this. In fact this is exactly what EventReduce could do for you.

For more information about the difference I recommend the video "Real-Time Databases Explained: Why Meteor, RethinkDB, Parse & Firebase Don't Scale" https://www.youtube.com/watch?v=HiQgQ88AdYo&t=1703s

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
The writes are not tunneled somehow through this algorithm. You still use the database like your normally would do. So the consistency is not affected.

Also this is an open source project, not something I want to sell you. Feel free to make a PR/issue with any open topics that are not mentioned in the docs.

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
There is a big difference between a database with an event stream and a 'realtime query' that can be created with event reduce.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
Yes this is correct. The performance benefit comes from doing all this stuff on the CPU instead of using disc-io. Also the internal binary decision diagram of EventReduced is optimized in a way to run less logic then a query would do. This makes it even faster then running the query again with an in-memory database.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
Not exactly. To use EventReduce you must have a changestream out of all writes to your data int the correct order. You can do that by wrapping a frontend over your database.

But easier you do that by using a database that already provides a changestream like couchdb, Postgres, mongodb and so on.

eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
No it is explicitly not for append-only data. It works with inserts, updates and deletes. I think I have problems understanding what exactly you mean by the need for a logical clock. The algorithm is feeded with the old query results plus one event, and then returns the new query results. Since there is only one event at each point of time, it does not have to order or maintain them.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
I do not think this has many in common. Lambda is used for stream processing much data. EventReduce is used for optimizing the latency of much (repeating) queries.
eventreduce··on EventReduce: An algorithm to optimize database queries that run multiple times
Yes the BDD is minimized with the two rules (reduction and elimination). Also the sorting of the boolean functions is optimized via plain brute forcing.

The was no good JavaScript implementation for BDDs so I had to create my own one https://github.com/pubkey/binary-decision-diagram

Page 1 of 2Next →