SpartaSystems / holdmail

HoldMail is a Java Application for proxying SMTP mail, providing a browsable viewer for captured emails.
Apache License 2.0
32 stars 15 forks source link

when more user access restful api , then OOM #47

Closed pkptzx closed 6 years ago

pkptzx commented 6 years ago

when more user access restful api , then OOM....

another app through holdmail rest api find new mail , soon after OOM or rest can't access but email smtp is work.

pkptzx commented 6 years ago

image

emmmmmmm....

need to optimization ....

hate & despise hibernate ....

pkptzx commented 6 years ago

close it , because i think u won't change it

barryoneill commented 6 years ago

Thanks for reporting this - I'm going to re-open it, because stuff like this should be tracked.

Can you give a little more detail?

In the meantime, you could try raising the -Xmx parameter to the application. If you're using the RPM, edit /opt/holdmail/bin/holdmail.conf and change the line

JAVA_OPTS=-Dloader.path=/opt/holdmail/lib

to

JAVA_OPTS="-Dloader.path=/opt/holdmail/lib -Xmx1024m"

And restart the holdmail service (note the addition of quotes around the whole value). Adjust Xmx for your use case..

It's possible (but unlikely) that the issue is with the h2 DB. You could switch out to something like mysql (see README on homepage for instructions) to see if the issue persists.

If you do any investigate or profiling, we'd love to see your notes!

I understand you may be frustrated at the speed of changes to holdmail, but it will get looked at eventually - volunteers welcome!

kblief commented 6 years ago

Another question is are you using Pagination in the rest api?

pkptzx commented 6 years ago

@kblief @barryoneill

two application access rest api , interval 100 second. (during this period for test, everyday just new 2-10 mail , attachment size 10-200k) but holdmail server already have 28516 mail.... have 20000+ is spam mail...

today exception: image

why? Server just have a holdemail , not have other service.

I don't have the experience of using h2.

pkptzx commented 6 years ago

why not attachment save to file system?

In our company , prohibited .

kblief commented 6 years ago

@pkptzx can you push your maven branch up to github?

kblief commented 6 years ago

You can try changing the connection pool.

https://brettwooldridge.github.io/HikariCP/

barryoneill commented 6 years ago

There are improvements to be made in the backend with regards to mails. If you're trying out master, some changes made in recent months should have improved things (not delivering the full RAW message in the summary), but further work can be done.

In general, it's a tradeoff in performance vs flexibility. On message receive, we could parse out and store html, text, and attachment metadata in the model. That would eliminate the need to query the raw column at all, except when fetching actual RAW or attachment content. However, that means more parsing and storing of metadata, which itself is a maintenance concern. Let's check that nothing more obvious is going on before re-architecting the backend:)

pkptzx commented 6 years ago

@kblief WOW....

h2 db is not working...not even after restart...

I found h2 db file size 2.1G ......

I can only delete it ... restart then normal...

johnament commented 6 years ago

h2 is really only good for unit testing, and small deployments. Once you are in a production like setup, its really important to move to an externally managed DB. In our deployment, we're using MySQL. We now feed 7 different environments into a single holdmail instance. Outside of doing a message purge to clean up the DB size we have not seen any major performance hiccups. Granted, the bulk of our use case is message ingestion and not querying.