B4J Question Using CloudKVS with more than one table

schimanski

Well-Known Member
Licensed User
Longtime User
I'm using Erel's CloudKVS-solution for more than 3 years in one of my projects and it is perfect for our needs. We are using it with up to 120 clients with only small data and it seems, that the server is far below his potential. I now want to provide it for other units. It think, max. 10 units. Each unit has also up to 120 clients. I think, SQLite is completely adequate for our needs, but in all threads over SQlite, my question is not finally answered:

My idea is now, to set up one table for each unit with

B4X:
Public Tabelname As String
..
....
sql.ExecNonQuery("CREATE TABLE " & Tablename & " (user TEXT, key TEXT, value BLOB, id INTEGER, time INTEGER, PRIMARY KEY (user, key))")
sql.ExecNonQuery("CREATE INDEX id_index ON " & Tablename & " (id)")

and with a server-filter to decide, which table is needed based on the user and password. With this solution, i don't have to touch the old table and we could further use it. Is that a feasible way or do i develop in a wrong direction?

Thanks for help..
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
If the table is in the same database you will still have locking of the complete file when you write to any table. That is how I remember sqlLite. I did do a CloudKVS years ago for MySql. It was for Erels V1 of CloudKVS. I know he has done other version so I do not know if it will work, That should work for many more clients clients.

 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Thank you very much for your reply. I saw your example of the cloudkvs with MySQL. For my use, it is much more easier to use SQLite.

if the table is in the same database you will still have locking of the complete file when you write to any table.

What does it means? I'm using wal-mode and it is only one server-application, which writes to the different tables. What do i have to do?
Thanks your for your efforts...
 
Upvote 0

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Thank you very much for your reply. I saw your example of the cloudkvs with MySQL. For my use, it is much more easier to use SQLite.

What does it means? I'm using wal-mode and it is only one server-application, which writes to the different tables. What do i have to do?
Thanks your for your efforts...


Oh yeah, Forget about WAL mode.
I think your idea of different tables is just fine. Basically though you have to try it and see how the performance is.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is that a feasible way or do i develop in a wrong direction?
It is of course feasible but you do need to carefully learn the code and see that you don't break anything. I cannot say it without doing some work.

The key is made of two values. You can use the first value to distinguish between the different units. This way you don't need to change anything in CloudKVS client or server code.
 
Upvote 0

schimanski

Well-Known Member
Licensed User
Longtime User
Thank you for your efforts, Erel and JakeBullet70!
Not to change the code of the CloudKVS is the best solution, i think.

The key is made of two values. You can use the first value to distinguish between the different units. This way you don't need to change anything in CloudKVS client or server code.
But i'm not sure, what you exactly mean:

D2E45BCF-72C5-4C67-90AA-6227D6FB7FA6.jpeg


I don't see a key of two values. Does i not need to work with the user, to make sure, that no one in unit 2 gets data from unit 1???
 
Upvote 0
Top