← Back to team overview

maria-developers team mailing list archive

Re: MDEV-4956 - Reduce usage of LOCK_open: TABLE_SHARE::tdc.used_tables

 

Hi, Sergey!

On Sep 11, Sergey Vojtovich wrote:
> > 
> > > For every statment we acquire table from table cache and then
> > > release table back to the cache. That involves update of 3 lists:
> > > unused_tables, per-share used_tables and free_tables. These lists
> > > are protected by LOCK_open (see tc_acquire_table() and
> > > tc_release_table()).
> > 
> > Why per-share lists are updated under the global mutex?
> I would have done that already if it would give us considerable
> performance gain.
> Alas, it doesn't solve CPU cache coherence problem.

It doesn't solve CPU cache coherence problem, yes.
And it doesn't help if you have only one hot table.

But it certainly helps if many threads access many tables.

> > How did you do the lock-free list, could you show, please?
> Please find it attached. It is mixed with different changes, just
> search for my_atomic_casptr.

Thanks.

> > > What we need is to reduce number of these expensive memory reads,
> > > and there are two solutions: partition these lists or get rid of
> > > them. As we agreed not to partition, I'm trying the latter
> > > solution.
> > 
> > Well, you can partition the list. With 32 list head pointers. And a
> > thread adding a table only to "this thread's" list. Of course, it's
> > not complete partitioning betwen CPUs, as any thread can remove a
> > table from any list. But at least there won't be one global list
> > head pointer.
> Yes, that's what Oracle did and what we're trying to avoid.

I thought they've partitioned the TDC itself. And sometimes they need to
lock all the partitions. If you only partition the unused_tables list,
the TDC is shared by all threads and you always lock only one
unused_tables list, never all of them.

Regards,
Sergei


Follow ups

References