Vacuum and removal of cluster level lock for plocal storage.
Currently updates are in place updates (use the same record space) to keep rid unchanged and record creation operations are forced to perform page defragmentation if it is not enough space which is not occupied by deleted records (some times will generate a lot of WAL records). But we able to perform append only record updates and creations. The page defragmentation(removal of unused space) will be performed on schedule basis (a la Apache Cassandra - compaction, InnoDB - purge, PostgreSQL - vacuum) by background process (lets call it Vacuum too )) ) . Such append only updates/creations will be - fast, will minimize amount of data in WAL, will not require record locking at all (we always have new record instance during update).
P.S. As side effect it will be useful to create some kind of performance suite to test all such big storage changes in future.
Any suggestions or objections are very welcome !!
Hi Andrey
The second approach seems more complex - but will be definite the one that makes more sense if the database gets bigger ins size cause if blobs as we did - are stored in the database. I would personally prefere the second approach to the problem and kind of compaction process in the backend that marks and reworks.
I'm not sure it the sstable approach cassandra has is the best fit - if it is implemented as it has been in the past that you need at least the double storage to compact the "tables" together. They changed a lot in this place but I personally do not know the progress in this parts of cassandra
I hope that you are going with the second approach as it gives more flexibility for growing databases - even an redistribution to "other" nodes could be easily possible if one node is full .
just my 2 cents
Mike
2013/8/11 Andrey Lomakin [email protected]
Any suggestions or objections are very welcome !!
— Reply to this email directly or view it on GitHubhttps://github.com/orientechnologies/orientdb/issues/1600#issuecomment-22453568 .
bayoda.com - DataStorage and Backup by nimbus Development IT Consulting GmbH
This would work, but I don't know the overhead to manage one hash index more for such purpose. In LOCAL storage we could avoid such recycling by avoiding to check in holes. At least for a while. Most of the problems could be fixed if the holes would reused after a time X? So we could use 3 strategies:
- early recycle -> like now
- lazy recycle -> holes should contains an additional timestamp (8 bytes) to avoid use it before X time is elapsed
- don't recycle -> holes are never reused. This means 15 bytes wasted per record. So if I've 100,000 deleted records I'd have 1.5MB of space wasted. It could be acceptable for many use case
WDYT?
Ops, the issue title is related to plocal so here it's a little off topic. I will open a new issue for that...
Done: #1601
Hi Michael, Sure second approach is definitely in our plans. Also want to add that currently to effectively reuse free space we use complex set of free list so it was hard for us to make it durable, free list , cache pages and so on. Using second approach we can rid of this complex free list structure and as side effect make much more weaker locking approach increasing possibilities for db scalability on multicore platforms.
P.S. Creation of auto sharding on cluster level is idea which is worth of thinking. We can create map-reduce SQL processing for distributed case use the same WAL solution for Merkel tree, and can speed up SQL queries if delegate record navigation to the cluster implementation, so it is really really worth of thinking.
We discussed with Luca and decided to keep list of rids with tombstones for both local and plocal case. It will be faster if we will have issue with it we always can fallback to hash index. But the rest is valid. This feature allows to rid off cluster locks and use only mvcc approach.
One more come in my mind, we use several relatively complex data structures to support "in place" updates, several free lists, lists but with append only mode and background cleaning of partially filled (or better to say deleted) pages, the underlying data structure can be simple as a hammer which means faster data processing and robust implementation.
What do you mean?
I mean that we have only in place updates of records now, not append only updates. So to reuse space which is freed because of deletes or updates we have 64 free lists each of which is responsible for pages which have free space from 0-to 1K , from 1K to 2K and so on. And we can not use heap data structures like tree map and so on because operation on them not logged so tx rollback may lead to data lost. Also we do page fragmentation if page has space by pieces but does not have continuous space to fit new record, to support this we have pointers list as header inside of each page which allows do defragmentation without breaking external pointers (it is not cluster position because list itmes are reused). all of this provides additional overhead. Iterating and updating page free lists before and after each update of each page not funny thing (supporting of header of pointers inside of page pretty cheap). But if we will have append only mode and background thread which will freed partially filled pages and once again append its content to the end of file. we will not have these free lists, so insertion and deletion operations will be faster.
Of course when I write "the end of file" I mean virtual end. The simplest approach for such case is quite simple )) For example we have file segments (we even do not need several files, single file with segments is enough) each segment should be big enough to make random io operations very rare, lets say 256m and enough to fit in memory, so at once one segment is finished, we append new segment, then we check if old segment has enough free space like say 25%, in such case we start background thread and move all data to new segment (we read old one for one shot, do defragmentation in memory not in disk, so it is fast), and mark old segment as free, so when we need new segment once again we just will reuse old one which is freed, if such one will exists of course.
If db user target is not to fill all the disk during 1 hour to crash server )) this operation will be rare, it is important note, because we use wal during data movement to make everything durable, which means that we will add about 500mb of wal, but I think users can live with this.
What is more interesting that is because we work most of the times in append only mode, we will have very high level of multi core support. I mean one user will not able to produce lets say 1000 rec/s overhead, but 100 users can. so multi core scallability is even more important than single thread speed. And append only mode means no locks, which is nice thing ).
@laa it's quite hard for me to follow this thread because when you say "So to reuse space which is freed because of deletes or updates we have 64 free lists each of which is responsible for pages which have free space from 0-to 1K , from 1K to 2K and so on. " but there isn't a place where this 64 free lists are explained. Also the "segment" concept is unknown. Is it a page or what? We definitely need documentation for plocal to let other to join us, otherwise everything you write it's just a memo for you.
The general impression is that everything is getting very complicated with a lot of structures we don't know if they speeds up or not current storage. What's the cost of the background thread? 256MB in memory per cluster? What if we've 100 class/clusters?
agree, I have written documentation only partially and will do tomorrow documentation for WAL and continue cache instead of atomic updates. It seems more useful.
About 256 mb it is the same memory consumption like for tx commit it consumes memory for processing and then makes it free, even we have 100 clusters it does not mean that we have to have 2 GB of memory. I will provide full spec for given proposal too.
Any way it is only way to discuss it.
Any updates if this is going to be fixed in coming versions?
yes, it will be implemented, today we will discuss on which schedule we will do it.
@laa What's the status of this? You wrote today 1y ago. Is it fixed?
It is part of https://github.com/orientechnologies/orientdb/issues/1677