The new shared database is noticeably slower than the old database implemention. In the old implementation, there was a persistant cache if information. We need to implement a similiar cache for the shared databse.
If you cache the data for the DB, you need to ensure there are no cache coherency issues. When ANY process modifies a part of the DB, the cache for that part MUST be invalidated for all processes that are sharing that DB. This very problem is why the old NSS databases were not safe for simultaneous access by multiple processes, IINM.
The cache would cache things like object id type is X. Changing the type of a given object id would most likely cause problems well above the PKCS #11 layer. I don't intend to do any database style caching.
Created attachment 279042 [details] [diff] [review] First performance patch This patch collects all the private key attributes into a single get attribute call. The result of this patch: certutil -L -d . with a database of 3 certs: dbm base-line: .014u/.009s Before this patch: sqlite local FS: .149u/.046s (10x user/5x system) sqlite network FS: .311u/.247s (22x user/27x system) After this patch: sqlite local FS: .067u/.018s (5x user/2x system) sqlite network FS: .094u/.052s (7x user/6x system) This patch basically cuts our local fs times by half and your network fs by 1/3. bob
Comment on attachment 279042 [details] [diff] [review] First performance patch r+ but the comment at the head of sftk_MultipleAttribute2SecItem() should read "copy multiple unsigned attributes..." shouldn't it?
checked in with neil's comments addressed (yes it should talk about multiple attributes). Checking in pkcs11.c; /cvsroot/mozilla/security/nss/lib/softoken/pkcs11.c,v <-- pkcs11.c new revision: 1.143; previous revision: 1.142 done Checking in pkcs11u.c; /cvsroot/mozilla/security/nss/lib/softoken/pkcs11u.c,v <-- pkcs11u.c new revision: 1.76; previous revision: 1.75 done Checking in pkcs11i.h; /cvsroot/mozilla/security/nss/lib/softoken/pkcs11i.h,v <-- pkcs11i.h new revision: 1.48; previous revision: 1.47 done
This should be fixed on the current tip