Does sqlite node build a queue?

Hi All,

Just a simple question to which I could not find the answer in the help of the node: does the sqlite node build a queue of the incoming requests? As there may be multiple concurrent listeners of the same sqlite db, it may easily lead to a conflict. So I was pondering if the sqlite node handles that situation itself or shall I build my own solution for it? My only problem is when I need to build it myself is that:

  1. subflows would come handy but they are instantiated so the number of listeners would be the same and they could still access the db concurrently.
  2. if I create a separate tab for the solution with a single sqlite node and the queueing logic around it, I'll need to use link nodes and take care about routing the output to the (one and only) appropriate tab back.

Thanks&regards,
r0ller

This isn't really a node-red question, it is an sqlite question. Yes sqlite can cope with multiple users simultaneously, however if you have a lot of parallel activity and you are concerned about performance then don't use sqlite, use one of the server based dbs which are designed for servicing parallel data, such as mysql, mariadb, postgresql or (if you are writing time series data) then influxdb.

Having said that, then within node-red make sure all the sqlite nodes use the same config node (the dropdown in the sqlite node should only show one entry for each database you use), then you don't need to worry about how many actual sqlite nodes you have, all the data will be channelled through the one connection so avoiding any issues with parallel activity.

Thanks for your reply. I know the use cases that fit for sqlite but I don't know how it is integrated into nodered especially when it comes to listeners. That's why I thought the more listeners I have, the more concurrent accesses may emerge. I also expected what you said that until the nodes use the same config I should not worry. However, I use a configurable path to access the db so my nodes are configured to use ${db} of which I somehow ended up having a ton in the configuration's dropdown. So it seems I just need to delete all configurations except one and set all sqlite nodes to use the one that remains.

1 Like

I had missed the fact that you said listener. How do you configure the sqlite node as a listener?

I may have used the term 'listener' the wrong way but I thought that the warning refers to the sqlite nodes by that term when I see on startup:

"Possible EventEmitter memory leak detected. 11 open listeners added to [Database]."

After which I see lots of lines like:

"15 Sep 19:43:28 - [info] [sqlitedb:6f4f50f9.9bb2a] opened /home/r0ller/pg/pg1.db ok"

I'd prefer seeing there one single line about opening the db. But I guess deleting all the db configs and using only one will solve the issue, won't it?

I think so, only one way to find out for sure.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.