> Fine grain locking may be 10x slower than with no
> locking, but as I recall from our mutual reading and
> discussions w.r.t. B-link trees, updaters only block
> each other (not readers)

The way I had to code it, readers still need to do a
synchronized check if they are blocked by a writer. 
The readers pay the 10X cost just for checking.  That
is not counting being blocked.   

It there is a way for the readers to not do a check it
would go faster.   Any suggestions would be very
interesting. 

> and only on competing for
> individual node locks, unlike some tree

That is basically why the cost higher. The check is
per node so an read requires about 4 checks (best case
(actaully 7 if we are using the cache)) vs a course
grain lock would only require 1 check

It is the read_lock_aquire() that is sucking up all
the time . 

> implementations that require require whole path
> locks to do updates (i.e. B-link trees are highly
> localized w.r.t. rebalancing, as opposed to
> pessimistic locking under T-Trees which tends to
> lock the entire path from the root to the node being
> updated).  As such the overall number of locks is
> still lower than for many other approaches, and

That is why I am currently leaning toward coarse
locking.  It is the least amount of locking. 

> using the lateral traverse link pointer, readers
> sail through, guaranteed that they will always
> eventually find the correct leaf node (if it exists)

yes it is in the code I implemented. 

> or properly fail the search.  
> 
> So I would suspect that until a very high % of
> activity becomes both read and update activity
> against a particular index in a particular table,
> this 10x overhead will really represent a much
> smaller overhead in terms of the overall time to

possibly true.  
If a index lookup is only 1% of the time spend dealing
with the query, then inflating it by 10 to get
finegrain locking may be ok. 
Depends on the relative costs in the rest of the
system.

> process any particular statement.  OTOH, what this
> does buy is virtually unblocked multiple concurent
> readers under multiple concurent writers, allowing a
> mix of short and long running queries to experience
> better perceived throughput; I think this will be

yes. fine grain locking is 'fairer' to multiple
threads.  If a very long query starts and then a short
read starts, the short read will not be greatly held
up by the long query.
But that price seems to be all index operation go 10X
slower. 

>And when
> developing software for the typical end-user, it is
> alway good to be able to provide a perceived
> increased responsiveness that is, within reason,
> closer to what the end-user expects than was
> previously being delivered.

It would be possible to make it configurable.  Maybe
turn on and off fine grain checks.   That would give a
developer a choice.   On the other hand BLinks are
much more complicated to code.  I still don't have a
good delete function

> 
> On another line of thought, straight BTrees may end
> up being even slower than B-link under concurrent
> access,

I will let you know, I should have a BTree varient
sometime next week. 

> using the same level of granularity (just a
> thought...since you've already implmented B-link. 
> OTOH, maybe not).  Have you done the research or
> analysis yourself to determine this one way or
> another?
> 
> Responding to another point, perhaps some middle
> ground can be found for granularity that lies


One idea I had was that updates completely lock the
table but all reads were unsynchronized.   This gives
you single check of course grain, but at least allows
lots of reads to occure.    


> between locking single nodes and locking entire
> high-level structures?  Certainly, there are
> opportunities, for example, to lazily rebalance,

BTrees would not change depth in a rebalance but they
would be able to release deleted memory. 

> concurrent vs thread-safe multiplexed) operation can
> be switched, based on load.  That is, with a single

yes but complicated.  Dont forget now you have added
another synchronized check to what the current mode is




=====
Karl Meissner

........................................................... 
: Meissner Software Development, LLC                      :
: "Software development and project management services." : 
: http://meissner.v0.net/resume.htm                       :
...........................................................

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

_______________________________________________
hsqldb-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers

Reply via email to