Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad performance of security checking during prepare [CORE1775] #2199

Closed
firebird-issue-importer opened this issue Mar 6, 2008 · 8 comments
Closed

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Mar 6, 2008

Submitted by: @hvlad

Jira_subtask_outward CORE1779

Votes: 1

Starting with 2.0 release security checks was slow compared with 1.5.x releases.

I have test case, sent to me privately, where prepare of statement took 15 ms on FB 1.5.4 and more than 90ms on higher versions.
Statement is UPDATE of table with few triggers with complex logic.

The reasons for slowdown is :
a) SCL_get_class search for given security class name within linked list of cached security classes (att_security_classes). This is slow as this list may contain hundreds of entries. Since v2.0 simple call of strcmp() was replaced by overloaded operator ==. Unfortunately it is not expanded inline thus slowdown.

b) Since v2.1 i see fetches from both RDB$RELATIONS and RDB$RELATION_FIELDS during prepare while v1.5.4 and v2.0.3 fetches only RDB$RELATION_FIELDS. I found that CMP\verify_trigger_access calls MET_lookup_field only before v 2.1 and both MET_lookup_field and MET_relation_default_class since v2.1. So far i didn't found reasons why it is so.

Offered solution :

a) in HEAD (v2.5) i'll replace linked list of SecurityClass'es by BePlusTree to allow faster searches.
This make prepare time in my test case again 15ms

b) in 2.0.x and 2.1.x releases i offer to return strcnmp() instead of operator == for string comparison in SCL_get_class
This make prepare time in my test case near 45ms

Commits: f808459 4505e0a 7d54298

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 6, 2008

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 6, 2008

Modified by: @hvlad

status: Open [ 1 ] => Open [ 1 ]

Fix Version: 2.1 RC2 [ 10250 ]

Fix Version: 2.0.4 [ 10211 ]

Fix Version: 2.5 Alpha 1 [ 10224 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 8, 2008

Commented by: @hvlad

Fix is committed into HEAD (2.5 alpha) and 2.0.4. As for 2.1 RC2 it seems it is too late, sorry. I'll add sub-task to commit fix into 2.1.1 or 2.1 RC3

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 8, 2008

Modified by: @hvlad

status: Open [ 1 ] => Open [ 1 ]

Target: 2.0.4, 2.5 Alpha 1, 2.1.1 [ 10211, 10224, 10223 ]

Planning Status: Unspecified => Considered for inclusion

Implementation: [Easy]

Fix Version: 2.1 RC2 [ 10250 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 8, 2008

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 17, 2008

Modified by: @dyemanov

issuetype: Improvement [ 4 ] => Bug [ 1 ]

summary: Improve performance of security checking => Bad performance of security checking during prepare

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 18, 2008

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 19, 2016

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment