{"action":"opened","issue":{"url":"https://api.github.com/repos/syndesisio/syndesis/issues/3717","repository_url":"https://api.github.com/repos/syndesisio/syndesis","labels_url":"https://api.github.com/repos/syndesisio/syndesis/issues/3717/labels{/name}","comments_url":"https://api.github.com/repos/syndesisio/syndesis/issues/3717/comments","events_url":"https://api.github.com/repos/syndesisio/syndesis/issues/3717/events","html_url":"https://github.com/syndesisio/syndesis/issues/3717","id":365899437,"node_id":"MDU6SXNzdWUzNjU4OTk0Mzc=","number":3717,"title":"Syndesis Server running at 75% CPU","user":{"login":"phantomjinx","id":1634180,"node_id":"MDQ6VXNlcjE2MzQxODA=","avatar_url":"https://avatars2.githubusercontent.com/u/1634180?v=4","gravatar_id":"","url":"https://api.github.com/users/phantomjinx","html_url":"https://github.com/phantomjinx","followers_url":"https://api.github.com/users/phantomjinx/followers","following_url":"https://api.github.com/users/phantomjinx/following{/other_user}","gists_url":"https://api.github.com/users/phantomjinx/gists{/gist_id}","starred_url":"https://api.github.com/users/phantomjinx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phantomjinx/subscriptions","organizations_url":"https://api.github.com/users/phantomjinx/orgs","repos_url":"https://api.github.com/users/phantomjinx/repos","events_url":"https://api.github.com/users/phantomjinx/events{/privacy}","received_events_url":"https://api.github.com/users/phantomjinx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-02T13:32:38Z","updated_at":"2018-10-02T13:32:38Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## This is a...\r\n\r\n<pre><code>\r\n[ ] Feature request\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[X] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Documentation issue or request\r\n</code></pre>\r\n\r\n## Description\r\nThe syndesis-server pod takes a lot of CPU! If left untamed it has a tendency to swipe 3 CPUs. If limited by Openshift to 1 CPU then it runs smoothly with 75% (while its couple of subordinate threads reside on 50%+). See htop screenshot.\r\n\r\nBy profiling the server, it is possible to get an idea of what is taking up the CPU time. The IntegrationUpdateHandler validates all integrations (including deleted integrations!) by calling validators on each integrations fetched from the DataManager. The trouble is the NoDuplicateValidator then fetches all the integrations from the DataManager in order to test for duplicates:\r\n\r\nIntegrationUpdateHandler:\r\n```\r\nList<Integration> integrations = DataManager.fetchAll(Integration.class ...)\r\nfor (Integration integration : integrations) {\r\n  ...\r\n  messages.addAll(computeValidatorMessages(supplier, integration));\r\n  ...\r\n}\r\n```\r\n\r\nNoDuplicateIntegrationValidator:\r\n```\r\n...\r\nfinal Set<String> names = dataManager.fetchAll(Integration.class).getItems().stream()\r\n...\r\n```\r\n\r\nFetching integrations from the DataManager is expensive and slow in this case since there is no caching of the integrations (or at least caching is not used since a DataAccessObject is available for the Integration [class](https://github.com/phantomjinx/syndesis/blob/master/app/server/dao/src/main/java/io/syndesis/server/dao/manager/DataManager.java#L216))."}}
{"actor":{"display_login":"phantomjinx"}}