Bug 981037 - [PERF] get mcs labels in constant time
[PERF] get mcs labels in constant time
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Rob Millner
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-03 16:31 EDT by Andy Grimm
Modified: 2016-11-07 22:47 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-22 11:20:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Andy Grimm 2013-07-03 16:31:48 EDT
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 16:33:22 EDT
Created attachment 768455 [details]
Patch to calculate mcs labels
Comment 2 Andy Grimm 2013-07-05 10:12:34 EDT
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 15:12:10 EDT
Thanks!  Patch looks good and gets the right numbers.
Comment 4 openshift-github-bot 2013-07-09 12:56:47 EDT
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 05:41:40 EDT
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.