The default bug view has changed. See this FAQ.

Shared Database implementation slow

RESOLVED FIXED in 3.12

Status

NSS
Libraries
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: Robert Relyea, Assigned: Robert Relyea)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

10 years ago
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.  
(Assignee)

Comment 2

10 years ago
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.
(Assignee)

Comment 3

10 years ago
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
Attachment #279042 - Flags: review?(neil.williams)

Comment 4

10 years ago
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?
Attachment #279042 - Flags: review?(neil.williams) → review+
(Assignee)

Comment 5

10 years ago
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
(Assignee)

Comment 6

10 years ago
This should be fixed on the current tip
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.