Date tis 01 januari 2019

Currently there is simple file based concurrency in guile-log that stores the state of a computation, but what about just persist the dynamic attributes?

For introducing persistancy data safety and concurrency a db backend is quite natural. This is for the case when the amount of data fit memory and is quite small. My data structures are also functional and that should map to the database application as well. The question is how to accomplish this and I will start experimenting to see what I can make.

The database should be a sql database and I will experiment with a postgresql backend. This is a good exersice because I want to learn more about databases. This database application would not use SQL queries a lot, but just dump the data into the database in a functional manner and keep the analysis and logic in the app. This means that no data is overwritten and garbage will be collected as times goes. The plan for garbage collection is to incrementally build a mirror database with no fluff in it and at some point swap in the clean one.

The benefits is that this will support full prolog dynamic predicates, but the amount of garabge it can produce should be moderate or else your app would get slow. Also the amount of data need to be limited, the overhead for each stored býte will be quite large and the whole database will be partly mirrored in the client app. Also the benefit is that we can manage the data in prolog witch can be useful.

Updateing, the intervalls of updating should be done using diffrenet strategies, the slow one is at each operation do an update. The benefit is that the coding in the app is simple, the downside is that if you are sitting on a line with latency to the database, things takes time. Pacing, e.g. we could at different time points update e.g. every second or every 1/10 of a second. And thirdly via an update command.

Concurrency. At an update we try to lock the database for the predicate, then see if someone has updated new information to the database, if soo we need to manage the concurrency in some way, some strategy is needed, we could say that if the predicates between the differnet entities does not unify we add the new data ontop of the old one and adjust the predicate to match the new state. Else we could define some simple strategies e.g. my first, his first, or a user define predicate. We shouled have time stamps and user names on the changes.

Finally if any of you have any suggestions or ideas please comment on the page.


Comments

comments powered by Disqus

~ Follow me ~