Reputation: 380
I wrote the JavaFX application and connected it to the local database in my Windows PC. Everything worked fine, but when I copied the database to the remote server and tried to connect, application became slower. I tried to sniff MySql session between PC and server, and came to decision that it is not the network issue, because the time between PC query and server responses last packet arriving is only 0.2 seconds while application take 4-5 seconds to show the result of the event. I know that better way is to run the web service on the remote server, but before changing application I need to know, why application became slower?
Here is the hibernate cfg file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://serverURLhere:3306/second_attempt_hibernate</property>
<property name="connection.username">usernameHere</property>
<property name="connection.password">passwHere</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping class="models.Employee"/>
<mapping class="models.Documents"/>
<mapping class="models.DocTypes"/>
<mapping class="models.DocStatuses"/>
<mapping class="models.MailOrder"/>
<mapping class="models.MailOrderStatuses"/>
</session-factory>
</hibernate-configuration>
Upvotes: 0
Views: 225
Reputation: 2786
I would be quite surprised of the contrary.
You do not specify what is the event you are referring to so it's quit difficult to give you an advice.
I would log many event and try to see which operations are the most expensive.
Surely DB initialization would take much more the 0.2 seconds, you are doing a validation and update of the DB with <property name="hbm2ddl.auto">update</property>
, which can be useful but takes time.
Optimization can be one of the most difficult task in programming, so try to isolate your problems as much as you can and test them in isolation to give proper weight to each.
Upvotes: 1