exacaster / lighter

REST API for Apache Spark on K8S or YARN
MIT License
91 stars 21 forks source link

Horizontal scaling and multiple backends #617

Closed julienlau closed 2 weeks ago

julienlau commented 1 year ago

Hi,

If the DB is hoster in a postgres instance isolated from Lighter, can Lighter be scaled horizontally ? For exemple :

Regards Julien

Minutis commented 1 year ago

It can be scaled horizontally. We are using Shedlock for locks when running more than one instance of Lighter. So generally having a few Lighter instances could help with HA but there are some limitations:

Regarding the separate Lighter configurations and separate backends, it could probably be done. But I would recommend separating the Lighters logically (separate DBs and endpoints configured) to get better visibility and debugging options.

julienlau commented 1 year ago

I don't understand the lock strategy of Lighter... The locks are not there to avoid Leader election between several Lighter instances ?

As I understand, the lock is used to avoid concurrency between update tasks: The locks are here to avoid bad operations form other task on a given Lighter instance : track session could interfere with create session.

If so, would it be possible to have a queue with a single thread doing update tasks and another queue with more threads for the reads or the concurrent-safe tasks ? Note: I do not know micronaut

Regards

Minutis commented 2 weeks ago

You are right regarding the lock strategy. Current implementation is just a simple way to ensure that there is some kind of redundancy but it is far from optimal.

Of course it's possible to implement different concurrency mechanisms but it takes time in both development and additional effort to test it.

We are always open for contributions though :) Closing for now.