Bug 981037 - [PERF] get mcs labels in constant time
Summary: [PERF] get mcs labels in constant time
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Rob Millner
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-03 20:31 UTC by Andy Grimm
Modified: 2016-11-08 03:47 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-22 15:20:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch to calculate mcs labels (1.42 KB, text/plain)
2013-07-03 20:33 UTC, Andy Grimm
no flags Details

Description Andy Grimm 2013-07-03 20:31:48 UTC
I'm not sure how big of a deal this is, but it bothers me that we're doing linear searches to "calculate" mcs labels, so I'd like to do it in constant time.  One solution would be to cache the mapping; another would be to use some middle school algebra. I'm doing the latter.

Comment 1 Andy Grimm 2013-07-03 20:33:22 UTC
Created attachment 768455 [details]
Patch to calculate mcs labels

Comment 2 Andy Grimm 2013-07-05 14:12:34 UTC
For a max uid of 7000, there's only about 0.1 second difference between the linear search and this patch (assuming the patch for https://bugzilla.redhat.com/show_bug.cgi?id=981022 is applied in both cases).  The linear search takes about 0.1 extra seconds for each additional 10000 uids, though. Also, on busy machines, the "real" or "wall clock" time can be much longer, which affects the user experience for things like ssh logins.

Comment 3 Rob Millner 2013-07-08 19:12:10 UTC
Thanks!  Patch looks good and gets the right numbers.

Comment 4 openshift-github-bot 2013-07-09 16:56:47 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/2a56f7939a0501a646566a129bc10f1dc3c320cb
Bug 981037 - Use an O(1) generator for the common use case.

Comment 5 Meng Bo 2013-07-10 09:41:40 UTC
Test on devenv_3471, the time of run oo-get-mcs-level reduced a lot than the stage_ami.

For stage:
[root@ip-10-147-131-70 ~]# time oo-get-mcs-level 523775
s0:c1021,c1023

real	0m3.426s
user	0m3.270s
sys	0m0.113s

For patched devenv:
[root@ip-10-152-170-195 ~]# time oo-get-mcs-level 523775
s0:c1021,c1023

real	0m0.309s
user	0m0.206s
sys	0m0.079s


Move bug to verified.


Note You need to log in before you can comment on or make changes to this bug.