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

Querying for &attributes=hardware.cpu_sockets is 0.5 seconds faster than num_cpu, WAT #872

Closed
jrafanie opened this issue Jul 24, 2020 · 2 comments · Fixed by #887 or #890
Closed
Assignees

Comments

@jrafanie
Copy link
Member

joerafaniello@Joes-MBP-2 manageiq % bundle exec miqperf benchmark -ac 5 -d "/api/vms?expand=resources&attributes=name,hardware.cpu_sockets"
D, [2020-07-24T14:55:14.826645 #30092] DEBUG -- : --> logging in...
D, [2020-07-24T14:55:15.048047 #30092] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,hardware.cpu_sockets
D, [2020-07-24T14:55:16.068500 #30092] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,hardware.cpu_sockets
D, [2020-07-24T14:55:17.008414 #30092] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,hardware.cpu_sockets
D, [2020-07-24T14:55:18.018111 #30092] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,hardware.cpu_sockets
D, [2020-07-24T14:55:18.906843 #30092] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,hardware.cpu_sockets
joerafaniello@Joes-MBP-2 manageiq % bundle exec miqperf report -l
/api/vms
|   ms | queries | query (ms) | rows |
| ---: |    ---: |       ---: | ---: |
|  952 |     563 |      405.8 | 1112 |
|  875 |     563 |      392.4 | 1112 |
|  884 |     563 |      393.9 | 1112 |
|  824 |     563 |      371.7 | 1112 |
|  890 |     563 |      392.8 | 1112 |
joerafaniello@Joes-MBP-2 manageiq % bundle exec miqperf benchmark -ac 5 -d "/api/vms?expand=resources&attributes=name,num_cpu"
D, [2020-07-24T14:55:46.390251 #30111] DEBUG -- : --> logging in...
D, [2020-07-24T14:55:46.600145 #30111] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,num_cpu
D, [2020-07-24T14:55:48.762894 #30111] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,num_cpu
D, [2020-07-24T14:55:50.871009 #30111] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,num_cpu
D, [2020-07-24T14:55:52.901907 #30111] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,num_cpu
D, [2020-07-24T14:55:54.991955 #30111] DEBUG -- : --> making GET request: /api/vms?expand=resources&attributes=name,num_cpu
joerafaniello@Joes-MBP-2 manageiq % bundle exec miqperf report -l
/api/vms
|   ms | queries | query (ms) | rows |
| ---: |    ---: |       ---: | ---: |
| 2010 |    1116 |      983.7 | 1665 |
| 1938 |    1116 |      955.4 | 1665 |
| 1873 |    1116 |      934.4 | 1665 |
| 1970 |    1116 |      956.0 | 1665 |
| 2017 |    1116 |      996.3 | 1665 |
@kbrock
Copy link
Member

kbrock commented Sep 22, 2020

I guess it would be nice if we knew how to swap between virtual attributes and delegation
a lot of that could be based upon creating the extra object

but I think of how I would try and solve this and I don't want to support my imagined code

@kbrock
Copy link
Member

kbrock commented Dec 8, 2020

I wonder if the performance hit is due to the fact that virtual attributes subqueries are run for every row, even those that are not brought back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants