Technical question on updating data via sockets in Wappler

Well you should see the client side PouchDB database - just as cached copy of your remote database. So if you really don’t want to store it, you can always delete it after you are done or after logout:

1 Like

and even easier with PouchDB - you can use the build-in memory store. So your data is just stored in memory and cleared automatically when the user leaves,

https://pouchdb.com/adapters.html

1 Like

Yes, it looks interesting. This may be the most optimal solution. But in any case, it requires research and rethinking of the application design and data model with subsequent data migration. It will take some time.

At the moment, if you could do this optimization:

This would solve a critical problem with sockets, would remove 60-80% of the load from the servers and sockets would no longer pose a danger to the application.

1 Like

If you have a lot of simultaneous users make sure that you run multiple instances of the node server, node is single threaded and can be a bottleneck if you have many concurrent requests. When having multiple instances memory is not shared, so to share state you’ll need Redis for your sockets and sessions. You can use Traefik as a load balancer.

I’ll work on some experimental improvements for sockets which I will then post in this topic for testing.

3 Likes

Thank you Patrick!

Yes, I am aware of the single-threaded nature of node js and its event loop. I use Traefik as a reverse proxy and load balancer and multiple replicas of containers for load balancing. Of course, in conjunction with Redis, for storing sessions and sockets.

Hi Patrick,
How do you configure sockets to use Redis ?

thanks
-John

If you enabled Redis in the Server Connect Settings it will be used automatically.

Perfect. Thanks Patrick

@Adetoyinbo1