user2219927 user2219927 - 1 year ago 80
Java Question

Slow spring-ws/hibernate application on osx

Recently I've got my new mac book. I port my java project(spring 4/hibernate 5/spring-ws/spring-security/tomcat/ojdbc) from Windows laptop. Everything works fine until yesterday. All request took very long time to proceed. Normally response from spring-ws endpoint took under 1s(with remote oracle db via vpn). Now it is about 16s. When I turn off spring-security(with same db for users, checking every soap request via basic http auth) in application, I can lower response to 6s.

With spring-security turned off(6s responses) i turn on logging for hibernate.stat and finds out that jdbc connection is established in about 5,5s.

I dont understand what happened. Responses on mac was fine before, after morning application redeploy it slow down. I tried different tomcat installation, local db, even reinstall my mac, no changes at all.

Edit: I run application in parallel on Windows laptop and there are no issues on Windows

Edit 2: I create console java app with simple jdbc connection and it take about 5s to establish connection. So it seems it is network related issue.

Edit 3: I switch oracle for postgresql db(same server) and postgre is doing fine. Oracle still slow.

Answer Source

Finally I realized what was the problem. As I said in edit 2, it was network related. My nameserver was not configured properly. So I have two options:

  1. edit /etc/resolv.conf and set correct nameserver ip or configure nameserver itself
  2. disable/comment /etc/resolv.conf nameserver and add db ip/host to /etc/hosts
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download