[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 10/11] tools/xenstore: drop use of tdb



On 29.06.23 13:30, Juergen Gross wrote:
On 20.06.23 15:09, Julien Grall wrote:
Hi Juergen,

On 30/05/2023 10:13, Juergen Gross wrote:
Today all Xenstore nodes are stored in a TDB data base. This data base
has several disadvantages:

- it is using a fixed sized hash table, resulting in high memory
   overhead for small installations with only very few VMs, and a rather
   large performance hit for systems with lots of VMs due to many
   collisions

- Xenstore is only single-threaded, while TDB is designed to be fit
   for multi-threaded use cases, resulting in much higher code
   complexity than needed

- special use cases of Xenstore are not possible to implement with TDB
   in an effective way, while an implementation of a data base tailored
   for Xenstore could simplify some handling (e.g. transactions) a lot

So drop using TDB and store the nodes directly in memory making them
easily accessible. Use a hash-based lookup mechanism for fast lookup
of nodes by their full path.

For now only replace TDB keeping the current access functions.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

...

-    set_tdb_key(db_name, &key);
-    data = tdb_fetch(tdb_ctx, key);
-    if (!data.dptr)
-        errno = (tdb_error(tdb_ctx) == TDB_ERR_NOEXIST) ? ENOENT : EIO;
-    else
-        *size = data.dsize;
+    hdr = hashtable_search(nodes, db_name);
+    if (!hdr) {
+        errno = ENOENT;
+        return NULL;
+    }
+
+    *size = sizeof(*hdr) + hdr->num_perms * sizeof(hdr->perms[0]) +
+        hdr->datalen + hdr->childlen;

AFAICT, this is the same computation as in write_node_raw. Can we introduce a wrapper for it?

Okay.

There is a difference: here we are using the values from xs_tdb_record_hdr,
while in write_node_raw() the values are taken from struct node.

I'll change that in a followup patch.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.