mmiklavc commented on issue #1439: METRON-2141 Cache REST API status update calls to the Storm UI URL: https://github.com/apache/metron/pull/1439#issuecomment-500617689 ### Check cache hits * Log into the Management UI, pull up your browser's DOM inspector, and checkout the Network tab. ![image](https://user-images.githubusercontent.com/658443/59230747-bb4ba780-8b9b-11e9-8043-747046e8f649.png) * Notice roughly every 5 seconds or so there is a new call to the REST API for Storm that takes roughly 1 second to complete. ![image](https://user-images.githubusercontent.com/658443/59229482-c3a1e380-8b97-11e9-8dd7-f0055862188c.png) * Open up Swagger via the Ambari Quick Links under Metron and click on the Storm Controller ![image](https://user-images.githubusercontent.com/658443/59229505-d1576900-8b97-11e9-9b49-6ff1ec97b2eb.png) * Click `Try it Out` once every couple seconds for about 15 seconds. ![image](https://user-images.githubusercontent.com/658443/59229531-dd432b00-8b97-11e9-9f3c-c4a5246bc7a2.png) * Look at the browser's Inspector networking view again. You should notice a significant drop in completion time as the browser is now getting data from the REST API's internal cache that is fronting the Storm service. ![image](https://user-images.githubusercontent.com/658443/59229558-f4821880-8b97-11e9-9a43-8fc6523b6ccd.png) ### Enable logging We can see the cache expire and log when it's getting updated values. * Check out https://github.com/apache/metron/tree/master/metron-interface/metron-rest#logging, and then go to the REST config section in Ambari ![image](https://user-images.githubusercontent.com/658443/59229718-6d817000-8b98-11e9-8f5c-84e8b86268b2.png) * Set Metron Spring Options to `--logging.level.org.apache.metron.rest.service.impl.CachedStormStatusServiceImpl=DEBUG` and restart the REST application. * Open up `/var/log/metron/metron-rest.log`. Without even logging into the Management UI again, you should see this line on startup `INFO 2625 --- [ main] o.a.m.r.s.i.CachedStormStatusServiceImpl : Creating S torm service cache with max size '10000', record expiration seconds '5'`. * Now login to the Management UI. If you refresh your metron-rest.log, you should start to see log lines like the following `DEBUG 2625 --- [nio-8082-exec-5] o.a.m.r.s.i.CachedStormStatusServiceImpl : Loading all topology status` roughly every 5 seconds. * Head back over to Ambari again, change the timeout to 30 seconds and restart once again. * Now you should the log entry about loading topology status only once every 30 seconds or so. ``` 2019-06-10 22:24:12.425 DEBUG 8305 --- [nio-8082-exec-6] o.a.m.r.s.i.CachedStormStatusServiceImpl : Loading all topology status 2019-06-10 22:24:44.307 DEBUG 8305 --- [nio-8082-exec-9] o.a.m.r.s.i.CachedStormStatusServiceImpl : Loading all topology status 2019-06-10 22:25:16.312 DEBUG 8305 --- [nio-8082-exec-6] o.a.m.r.s.i.CachedStormStatusServiceImpl : Loading all topology status 2019-06-10 22:25:49.188 DEBUG 8305 --- [nio-8082-exec-9] o.a.m.r.s.i.CachedStormStatusServiceImpl : Loading all topology status ``` * You'll also see a line printed at startup with the new config value `INFO 8305 --- [ main] o.a.m.r.s.i.CachedStormStatusServiceImpl : Creating Storm service cache with max size '10000', record expiration seconds '30'`
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services