[ https://issues.apache.org/jira/browse/STRATOS-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nirmal Fernando updated STRATOS-939: ------------------------------------ Description: How we calculate gradient of two events? Say the events are; e1(t1,v1) and e2(t2,v2) tx - time in milliseconds when xth event occurred vx - value (memory, cpu etc.) that xth event carries time gap = t(2-1) = t2 -t1 milliseconds time gap in seconds = t(2-1) = (t2 - t1)/1000 seconds Hence, Gradient = (v2 - v1) / t(2-1) = ( (v2 - v1) * 1000 ) / (t2 - t1) I've enabled debug logs for CEP extension; log4j.logger.org.apache.stratos.cep.extension=DEBUG Please find the following 3 logs extracted from the debug logs; =================================================================== TID: [0] [STRATOS] [2014-11-05 19:47:27,073] DEBUG {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - Gradient: -0.1996007984031936 Last val: 9.0 First val: 12.0 Time Gap: 15030 t1: 1415213202095 t2: 1415213217125 hash: 155426542 TID: [0] [STRATOS] [2014-11-05 19:47:27,073] DEBUG {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - Gradient: -999.9999999999998 Last val: 7.000000000000001 First val: 12.0 Time Gap: 5 t1: 1415213232152 t2: 1415213232157 hash: 155426542 TID: [0] [STRATOS] [2014-11-05 19:47:27,074] DEBUG {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - Gradient: -44.34884666437174 Last val: -999.9999999999998 First val: -0.1996007984031936 Time Gap: 22544 t1: 1415213209610 t2: 1415213232154 hash: 155426542 =================================================================== So, as you can see the reason behind a large value is when the time gap between two subjected events is less than 1 second. This could happen since events are coming from different asynchronous agents and also when there are less number of events. FIX ==== So, the fix I propose is a very simple one and it will not compromise anything AFAIS. Fix is to calculate time gap as follows; __ t2 - t1 | yes? time gap = t(2-1) = t2 -t1 > 1000 --- |__ 1000 I have tested this and works fine. was: How we calculate gradient of two events? Say the events are; e1(t1,v1) and e2(t2,v2) tx - time in milliseconds when xth event occurred vx - value (memory, cpu etc.) that xth event carries time gap = t(2-1) = t2 -t1 milliseconds time gap in seconds = t(2-1) = (t2 - t1)/1000 seconds Hence, Gradient = (v2 - v1) / t(2-1) = ( (v2 - v1) * 1000 ) / (t2 - t1) I've enabled debug logs for CEP extension; log4j.logger.org.apache.stratos.cep.extension=DEBUG Please find the following 3 logs extracted from the debug logs; =================================================================== TID: [0] [STRATOS] [2014-11-05 19:47:27,073] DEBUG {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - Gradient: -0.1996007984031936 Last val: 9.0 First val: 12.0 Time Gap: 15030 t1: 1415213202095 t2: 1415213217125 hash: 155426542 TID: [0] [STRATOS] [2014-11-05 19:47:27,073] DEBUG {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - Gradient: -999.9999999999998 Last val: 7.000000000000001 First val: 12.0 Time Gap: 5 t1: 1415213232152 t2: 1415213232157 hash: 155426542 TID: [0] [STRATOS] [2014-11-05 19:47:27,074] DEBUG {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - Gradient: -44.34884666437174 Last val: -999.9999999999998 First val: -0.1996007984031936 Time Gap: 22544 t1: 1415213209610 t2: 1415213232154 hash: 155426542 =================================================================== So, as you can see the reason behind a large value is when the time gap between two subjected events is less than 1 second. This could happen since events are coming from different asynchronous agents and also when there are less number of events. FIX ==== So, the fix I propose is a very simple one and it will not compromise anything AFAIS. Fix is to calculate time gap as follows; ____ t2 - t1 | yes? time gap = t(2-1) = t2 -t1 > 1000 --- |____ 1000 I have tested this and works fine. > CEP sends very large values for gradient and second derivative of load average > ------------------------------------------------------------------------------ > > Key: STRATOS-939 > URL: https://issues.apache.org/jira/browse/STRATOS-939 > Project: Stratos > Issue Type: Bug > Components: CEP > Affects Versions: 4.1.0 M3 > Reporter: Nirmal Fernando > Assignee: Nirmal Fernando > Priority: Critical > Fix For: 4.1.0 M4 > > > How we calculate gradient of two events? > Say the events are; e1(t1,v1) and e2(t2,v2) > tx - time in milliseconds when xth event occurred > vx - value (memory, cpu etc.) that xth event carries > time gap = t(2-1) = t2 -t1 milliseconds > time gap in seconds = t(2-1) = (t2 - t1)/1000 seconds > Hence, > Gradient = (v2 - v1) / t(2-1) = ( (v2 - v1) * 1000 ) / (t2 - t1) > I've enabled debug logs for CEP extension; > log4j.logger.org.apache.stratos.cep.extension=DEBUG > Please find the following 3 logs extracted from the debug logs; > =================================================================== > TID: [0] [STRATOS] [2014-11-05 19:47:27,073] DEBUG > {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - > Gradient: -0.1996007984031936 Last val: 9.0 First val: 12.0 Time Gap: 15030 > t1: 1415213202095 t2: 1415213217125 hash: 155426542 > TID: [0] [STRATOS] [2014-11-05 19:47:27,073] DEBUG > {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - > Gradient: -999.9999999999998 Last val: 7.000000000000001 First val: 12.0 Time > Gap: 5 t1: 1415213232152 t2: 1415213232157 hash: 155426542 > TID: [0] [STRATOS] [2014-11-05 19:47:27,074] DEBUG > {org.apache.stratos.cep.extension.SecondDerivativeFinderWindowProcessor} - > Gradient: -44.34884666437174 Last val: -999.9999999999998 First val: > -0.1996007984031936 Time Gap: 22544 t1: 1415213209610 t2: 1415213232154 hash: > 155426542 > =================================================================== > So, as you can see the reason behind a large value is when the time gap > between two subjected events is less than 1 second. This could happen since > events are coming from different asynchronous agents and also when there are > less number of events. > FIX > ==== > So, the fix I propose is a very simple one and it will not compromise > anything AFAIS. > Fix is to calculate time gap as follows; > __ t2 - t1 > | yes? > time gap = t(2-1) = t2 -t1 > 1000 --- > |__ 1000 > I have tested this and works fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)