Advice please about speed/server load/resources

Goodmorning!
My application uses a database request to get items for its navigation that needs to be loaded on every page request.
Although the request is a very simple query, I worry about the overall performance a little. Would it be better to cache this or should I not worry about a simple query?
Is some kind of caching is the way to go, can someone point me in the right direction on how to do this (with wappler)?

Also the same kind of problem with notifications in my app; every user can have a or a few notifications. This must be checked in the database and shown on every page...
Is there an easy cache solution for this without having to check it on every page?

Thanks!

Hi!

Just follow this tutorial:

For the notification it depends on, would you please explain that part?

Gabor

1 Like

Thnx Gabor! Will look into that :slight_smile:

The notifications are visible like in any other app as a numer of notifications in a red circle in the navigation bar over some bell-icon (think whatsapp or any other app)
When the user clicks the bell-icon a dropdown displays the titles of the unread notifications.

Something like that...

Actually, just like the Wappler community app.

ok, then you can cache the same way, I guess there is a server action that makes it read onclick or something and on success you reload the notifications. At that step make sure you check the reload checkbox, so when the notification action runs again it is not coming from cache.

Thanks Gabor. I have some homework to do now.
Thnx for pointing me in the right direction. :+1:

I’m guessing with these worries that you have come from Bubble? :thinking:

I had the same concerns when I arrived at Wappler and built all sorts of caching things that I didn’t need.

I would recommend you just get what you need when you need it using a Server Action and database query…

… and all will be good! :tada:

Hi Anthony,
No I don't come from Bubble just a concern I have if I scale this app, and it feels like unneccesary to load the same data on every page.

So you are saying, don't worry and load those queries on every page.
Maybe you are right and I worry to much about this.

I will look into this and at leasrt understand/learn how optimizing/caching works.

Thanks

1 Like

Your concern is valid but I think you shouldn't worry about it yet. There's only one ideal solution (in my opinion), and that's caching the Database Query steps. The Database Query steps have no built-in option for cache, and there's no separate Cache step/group which you could put a Database Query inside. So, your ideal cache solution doesn't exist yet. If you ever reach the point where you need to scale the app then you'll either:

  1. Horizontally scale the database server with e.g. read-only replicas
  2. Write (or hire someone to do) a custom Wappler extension to Cache database queries

You do have a middle-ground solution right now, that's the Wappler Redis custom extension that allows you to GET/SET data in Redis, so you could implement some logic to retrieve data from Redis first, and if the data is not present then you perform the database query and save the data into Redis. But I'm guessing you're a beginner, in my opinion you don't need that kind of overhead right now, you just need to be aware in case you need it later.

1 Like

Thanks @Apple. Appreciate your feedback.