Can javax.mail.Session.setDebug() to true slow the application down? - jakarta-mail

We would like to know how our application is sending email by setting javax.mail.Session.setDebug() to true. It looks like doing this slows the application down. We would like to verify that this is the case. Has anyone ever had experience with running the mail session in the debug mode. Otherwise, we need to find out why our app is underperforming.

Obviously doing the additional work of writing the debug output is going to slow the application down. How much it slows it down will depend on where the output is being written.

Related

How to find what freezes Chrome when it runs an AngularJS application?

I'm inspecting a performance issue with an AngularJS application.
When performing specific actions, the CPU usage goes to 100%, the Chrome window freezes, and I have to manually terminate the process using Chrome's task manager.
I tried to debug the app (DevTools' Sources tab), but the application is quite large and the code is minified, which means that finding the issue won't be easy: I see a lot of code triggered by the digest cycle, and can't figure out which code is the actual culprit.
What could be helpful is to be able to profile the application once it freezes; I'm pretty sure the profiler will immediately show the actual bottleneck. I can successfully start the profiler (Performance tab) before the freeze happens, but once the application freezes, when I click on Stop button, the Loading profile window is stuck at zero percent (I waited for fifteen minutes just to be sure, it's still at zero), so I suppose that it's frozen as well.
Therefore my question is:
How do I find what causes the application to freeze when I'm unable to figure it out by simply debugging the application?
To answer my own question, the solution was to use a different browser. Surprisingly, Firefox let me profile the application during the freeze. The remaining part was easy, as I expected: by comparing the profiling results before the freeze with the ones after it, one could figure which code is executed repeatedly.
Thanks to Aleksey Solovey as well for his comment.

Using backends and google cloud store to efficiently process large data files

This is a follow up on my question regarding processing large files using google app engine. The solution was Google Cloud Storage and I've spent the whole day wrestling with it and have run into some big issues.
The backend I'm using is a B4_1G. And I'm trying to process a 55mb sized xml file. The code currently is pretty basic, I'm just trying to make sure I can simply print out the file to a user before I start doing anything fancy with it:
gcs_file = gcs.open(filename)
gcs_file.seek(0, os.SEEK_SET)
for line in gcs_file:
self.response.write(line)
gcs_file.close()
The result is that the backend simply crashes. On the browser it spits out "Uncaught application failure" (even though it's nestled in a try, except statement). On my logs it says:
"The process handling this request unexpectedly died. This is likely to cause a new process to be used for the next request to your application."
I've tested this code with a tiny hello world text file and it works. So my guess is that as a beginner I'm doing something so inefficient that it's causing the server to crash after a few minutes. I have considered chaining tasks to do it, but I really would prefer not to write all that extra code... there must be a way to do it in backends right?
After messing around it a ton, it turns out the self.response.write was the problem. My guess is, printing out 55mb messed the whole thing up. Once I removed that and added my processing code, I noticed that everything was working fine :).

Winforms app as Scheduled task

I've got a winforms app that I developed to do batch processing on tens of thousands of students, now we're trying to run it nightly as a scheduled task.
I personally find it useful to be able to login to the box and see how it's processing by looking at the GUI, though the standard way it to convert it into a commandline app.(which radically limits the amount of screen realestae I can use for loggin messages)
Can I run the app as a schedueld task, the IT Guy whos scheduling says it's not running because it's a winform app. Are there any tricks needed to get it to run well, or am I forced to rewrite it as a commandline app with it's 80 char width limit.
Basicaly I just echo the log file to the screen in realtime to make debugging issues easier. So the gui is output only.
Its' running as the currently loggedin user, but the issue is that it does not run if the user is not currently logged in on the box,so when we leave for the night it fails to run.
Thanks,
Eric-
You need to make sure it is running as the currently logged in account. If it runs as 'system' I don't think it will show up correctly.
I have one of these myself... and despise it. It only exists because I haven't had a chance to rewrite it into a proper service. Don't forget there are more ways to log than just outputting to the console. ;)

Inaccessible database

I'm working on an rather small application (C#, winform) that is kind of front-end to MS Access database file stored on shared drive. While it is possible that drive could be down I am checking connection while loading Main Form.
I would like to know your opinions on how to deal with this problem.
I came up with ideas like:
Application shows only MessageBox
with an error message and close
itself (before actually showing up),
as it won't be useful at all.
Application load itself and then
display an error-message to not make
users confused (if they click warning
before reading the explanation).
What are yours best practices?
I think it's rather irrelevant whether the application is shown or not because in the end, you display the message box with the error anyway. The user clicks OK and you close your Application.
However, to me it's a bit nicer without the application showing in background, mainly because it makes no sense to fire it up when the database isn't available. Save yourself (and the pc) the time it takes to show it ;)

What should you do if a required asset fails to load?

My program is in Flex but it doesn't really matter for the question I am asking. OK say I need to load an XML file for the application to work at all. If I capture an IOError while the xml file is loading, what logically should I do with that? The application needs it or the app is useless, so should I just keep re-trying on error, or should I notify the user to try again later? What would you do?
Thanks.
Ask the user what to do - Retry or Fail, with Fail meaning the app will close . If it makes sense, give the user a chance to browse to the resource.
It really depends on the nature of the file. If you know the file will exist at one time, it may make sense to wait for the file's creation (although this seems like a poor man's network model). However, in situations where an application is useless without a resource, I would fail unrecoverably and give meaningful error messages to the user, as well as log some debugging code to a file that the user could later submit for developer debugging.
Like GMail - do both. Notify the user when an error happens or a timeout is hit, and keep trying in the meantime.
Loading is taking longer than expected, retrying - please wait...
Notify the user that the XML is not available, and offer the user the possibility to retry loading the XML, locate another XML or quit the application.
I don't think you should really try to many times that the page has noticeable lag. It really depends on whether the file being accessed is controlled by a third party or not and whether it is usually failing for large chunks of time or just say a second.

Resources