-errorstack parameter performance

Posted by Aliaksandr Tarasevich on 30-Mar-2015 09:41

Hello,

We use UNDO THROW in many places in our application, while it helps a lot with error handling, sometimes it gets very difficult to debug error in production (especially if something happened 3-4 levels deep) because the error stack shows only the place where an error was caught. We want to use -errorstack parameter but the documentation states:

While saving the call stack is a useful debugging feature, it can also consume resources and can potentially affect performance. Enabling ERROR-STACK-TRACE with this startup parameter is not recommended in a production environment.

Is somebody uses this parameter in production environment, what is the performance impact? If it's big enough to not enable it, please, share the best practice on how you find (maybe even automatically push to front-end) the place where your app failed (especially when you have a bunch of load-balanced app servers)

Thank you

All Replies

Posted by Frank Meulblok on 02-Apr-2015 03:40

"what is the performance impact?"

Performance impact will depend on how many exceptions are being thrown around, and the average stack depth.

But you'll see:

- Increase of memory consumption, up to 32k per exception (usually far less, only a few K at most), as the exception's CallStack property will hold the callstack.

- Extra processing time when an exception is thrown, as the AVM will have to unwind the stack to create the snapshot at that moment.

If you want to estimate the impact for your application, try it in a test environment first.

"If it's big enough to not enable it, please, share the best practice on how you find (maybe even automatically push to front-end) the place where your app failed (especially when you have a bunch of load-balanced app servers)"

You could write custom messages to the appserver log from within your CATCH blocks, via LOG-MANAGER:WRITE-MESSAGE(). Gives you full control of the diagnostic info you want to write out for a given type of exception.

That also costs *some* resources, but not much - from my personal experience, biggest concern there is how much disk space the extra logging will consume, and at what rate..

Posted by Aliaksandr Tarasevich on 03-Apr-2015 12:11

"You could write custom messages to the appserver log from within your CATCH blocks, via LOG-MANAGER:WRITE-MESSAGE(). Gives you full control of the diagnostic info you want to write out for a given type of exception."

If you don't use -errorstack flag, by the time you caught an error in CATCH block you already lost stack trace (unless you add CATCH block on each level). Plus, if you write errors to logs and use load-balanced AppServers it takes time to find which AppServer was handling request.

But, sounds like impact is not that big, since it doesn't consume anything unless error was thrown and even then a few K is not that big a deal.

Thank you,

Aliaks

This thread is closed