Hi  Alexander,

Any suggestions on below shared aspect.. ..?

Regards,
Rajendra Bhat

On Mon, Sep 28, 2020 at 11:14 AM Rajendra Bhat <[email protected]> wrote:

> Hi  Alexander,
>
> Thanks for your quick response.
>
> We have added the below aspect, I believe it should not cause not much
> latency.
>
> @Pointcut("execution(* xx.xx.xx.xx.rest.customfilter.doFilter"
>
> + 
> "(javax.servlet.ServletRequest,javax.servlet.ServletResponse,javax.servlet.FilterChain))
> && args(request,response,filterChain) && if()")
>
>
> We used "around" the advice. Advice logic as below.
>
>
> HttpServletRequest req = (HttpServletRequest) request;
>
>
>
>     *if* (!req.getRequestURI().startsWith("/admin")) {
>
> String shadowHeader = req.getHeader("XXX");
>
> String rugsUuidHeader = req.getHeader("XXX");
>
> *if* (logger.isDebugEnabled()) {
>
> logger.debug(shadowHeader + "--" + req.getRequestURI());
>
> }
>
> *if* (!StringUtil.*isEmpty*(shadowHeader)) {
>
> xxxStore.*getInstance*().addContext(*new* xxxContext(shadowHeader));
>
> xxxLogStore.*getInstance*().initializeShadowLog(xxxStore.*getInstance*
> ().getContext().getCorrelationId());
>
> } *else* *if* (!StringUtil.*isEmpty*(rugsUuidHeader)) {
>
> xxxStore.*getInstance*().addContext(rugsUuidHeader);
>
> }
>
>     }
>
> *return* (jointPoint.proceed());
>
>
>
> And another aspect on @Pointcut("execution( *
> org.springframework.messaging.MessageChannel.send(org.springframework.messaging.Message,long))
> . in
>
>
> This also around advice, inside we are doing if condition and log4j
> logging.
>
>
> Could please advise below aspect is causing 30 ms latency, something else
> we need to tune..?
>
>
> Regards,
>
> Rajendra Bhat
>
> On Sat, Sep 26, 2020 at 5:43 AM Andy Clement <[email protected]>
> wrote:
>
>> There is a patch (and github fork) here
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=565450 that someone made
>> that is supposed to help I think - it isn't integrated because I haven't
>> had time to try it out and review it. If you feel like building an AspectJ
>> to try it out, that might be more evidence we should get integrated sooner
>> rather than later.
>>
>> Andy
>>
>> On Thu, 24 Sep 2020 at 20:18, Alexander Kriegisch <
>> [email protected]> wrote:
>>
>>> Hi Rajendra.
>>>
>>> Thanks for the question and the hep dump screenshot. Compile time
>>> weaving (CTW) would not solve your latency problem. In comparison to
>>> load time weaving (LTW) you would only save time for class-loading
>>> during application start-up. After LTW is done, the application's
>>> performance should be the same as with CTW.
>>>
>>> Memory consumption and performance impact of AspectJ are strongly
>>> correlated with what your aspects do and how broadly they are applied to
>>> the target classes. So I am afraid without seeing your aspect code
>>> nobody will be able to help you. The number of aspects, pointcuts and
>>> advice is way less relevant than scope (pointcut) and content (advice
>>> method implementation) of the aspects as such. For example, a simple
>>> advice like this can be potentially super expensive:
>>>
>>> before() : call(* *(..)) {
>>>   doSomeExpensiveLogging();
>>>   useSomeExpensiveExternalResource();
>>> }
>>>
>>> Why? Because it would globally apply to each method call in your whole
>>> application. This would be just as slow as if without AOP you would add
>>> those method calls to each place in your code before calling methods. In
>>> most cases it is not AspectJ as such which causes huge overhead (even
>>> though both the runtime and the weaver of course consume a few
>>> resources, which usually is no problem, but what the aspect does and how
>>> many times. Hence, the problem usually sits in front of the keyboard,
>>> even though it is of course possible that there is a memory leak or
>>> other problem in AspectJ.
>>>
>>> Bottom line: Please provide more information, especially full aspect
>>> code. aop.xml would also be nice.
>>>
>>> Regards
>>> --
>>> Alexander Kriegisch
>>> https://scrum-master.de
>>>
>>>
>>> Rajendra Bhat schrieb am 25.09.2020 09:36 (GMT +07:00):
>>>
>>> > we observed around 10% latency overhead after adding aspectj LTW.
>>> > during the heap dump I observed lot memory consumption related to the
>>> > aspectj.
>>> >
>>> > Around 400 MB consumed by Aspecj, I have added 2 to 3 inteception.
>>> >
>>> > hereby attached heap dump details.
>>> >
>>> > please advise how to overcome on this..? We cannot use compile-time
>>> > weaving, because we adding aspect on the external jar.
>>> _______________________________________________
>>> aspectj-users mailing list
>>> [email protected]
>>> To unsubscribe from this list, visit
>>> https://www.eclipse.org/mailman/listinfo/aspectj-users
>>>
>> _______________________________________________
>> aspectj-users mailing list
>> [email protected]
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/aspectj-users
>>
>
>
> --
> Thanks and
> Regards
>
> Rajendra Bhat
>


-- 
Thanks and
Regards

Rajendra Bhat
_______________________________________________
aspectj-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to