Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC: Fractal Service (load balancer) #536

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

PoC: Fractal Service (load balancer) #536

wants to merge 2 commits into from

Conversation

BobdenOs
Copy link
Contributor

@BobdenOs BobdenOs commented Mar 18, 2024

Fractal Service

By tracking database query targets. Create short lived caches (using @cap-js/sqlite) which all instances redirect their queries to. Creating a live cache which can be queried reliably. Greatly reducing the load on the underlying database. While also greatly increasing query response times overall.

With the capability to integrate the load tracking with the BTP load balancer custom metrics. Allowing the creation of new application instances when heavy application loads are detected. Removing the local cache limits inherited from the application memory allocation.

Example

Local SQLite cache vs pure locally hosted Postgres.

queries fractal(sqlite cache) postgres
1 cold 5ms 5ms
10 cold 11ms 28ms
10 warm 4ms ~
100 cold 42ms 256ms
100 cold 30ms ~
1000 cold 338ms 2397ms
1000 warm 302ms ~

Diagram

Diagram demonstrating how the queries are tracked and the cache is utilized by multiple application instances.

sequenceDiagram
    Clients->>+CAP1: SELECT
    Clients->>+CAP1: INSERT
    CAP1->>+CAP0: Request Token (2)
    Clients->>+CAP0: SELECT
    CAP0->>CAP0: Request Token (1)
    CAP0->>-CAP1: Grant Ownership
    CAP1->>+DB: SELECT
    DB->>-CAP1: return
    CAP1->>+CAP1: CACHE
    CAP1->>-Clients: return
    CAP0->>+CAP1: SELECT
    CAP1->>-CAP0: return from cache
    CAP1->>-Clients: return
    CAP0->>-Clients: return
    CAP1->>+CAP1: CACHE TIMEOUT
    CAP1->>+DB: FLUSH
    DB->>-CAP1: return
    CAP0->>+CAP0: CACHE TIMEOUT
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant