in reply to Database access and async web framework (like Mojolicious)

I can only speak from experience with my own web framework. Long running (background) processes keep their DB handle open (often for days on end). Web uses two different strategies: Occasional access is on-demand (XMLHttpRequest from JavaScript). Long running stuff keeps a websocket open, which means the web backend also keeps a database handle open.

I use PostgreSQL as the database. I usually connect via UDS (unix domain sockets), this is much faster and less resource intensive than TCP. Give PostgreSQL a try, it's (in my opinion) much better at dealing with hundreds of connections than SQLite, and it's also much more capable at dealing with large datasets and complicated queries¹


¹ Your application might not have reached that point yet. But that stuff has a tendency to sneak up on you. It's always better to switch to a "big" database rather sooner than later. PostgreSQL is easy to install. If you are using any kind of Linux, there's most likely a package waiting for you in your package manager.

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Also check out my sisters artwork and my weekly webcomics
  • Comment on Re: Database access and async web framework (like Mojolicious)

Replies are listed 'Best First'.
Re^2: Database access and async web framework (like Mojolicious)
by bliako (Abbot) on Dec 18, 2024 at 09:27 UTC

    thanks, I am now giving postgres a try. It's a rough ride. Still looking how to login as admin, nobody asked me to set any admin password. Once I get in there I have to disable the initdb: warning: enabling "trust" authentication for local connections. I am now trying to find that dreaded config file. And disable ports, enabling only local socket access. Oh yes rant off. But still interested to see how it is going to be after this initial hiccups.

      Still looking how to login as admin

      The postgres O/S user should be able to do that locally without a pw (initially at least). From there you can start assigning roles and auth as you please.


      🦛

        ok, thanks, i am doing that. su is my friend.