I have a program that uses Spring, Hibernate and MySql. When running a process that inserts or updates a number of entities, we are experiencing a gradual slowdown on object loading. At the start, the time to load an object is very quick, but by the time we've processed a few hundred items the times are getting into a few seconds, and after a couple thousand it's taking 30 seconds. I can execute the same query against the database and get the results in << 1s (that's while the slow code is running and the query is executed against the same database the code is loading from). This information leads me to believe that the problem lies somewhere in my code and isn't a database problem.
Is there anything in general that would account for this type of problem? e.g. not flushing the hibernate template frequently enough, doing it too often, transaction configuration, etc.
I've included some extracts from my configuration files (I tried to pull out the parts that I thought were relevant).
Thanks.
Colin
Code:<bean id="transactionProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager" ref="transactionManager" /> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean>Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" > <beans> <bean id="widgetDao" parent="transactionProxyTemplate"> <property name="target"> <bean class="com.travelgator.entityupdate.daoimpl.widgetDaoImpl" singleton="false"> <property name="hibernateTemplate" ref="hibernateTemplate" /> </bean> </property> </bean> <bean id="workflowDao" parent="transactionProxyTemplate"> <property name="target"> <bean class="com.travelgator.entityupdate.daoimpl.WorkflowDaoImpl" singleton="false"> <property name="hibernateTemplate" ref="hibernateTemplate" /> </bean> </property> </bean> <bean id="widgetProductSax" class="com.travelgator.entityupdate.feeds.widget.widgetProductsElementHandler" singleton="false"> <property name="dao" ref="widgetDao" /> <property name="workflowDao" ref="workflowDao" /> <property name="bookingAgentId" value="${widget.agent.id}" /> </bean> <bean id="widgetProductXmlScriptProcessor" class="com.travelgator.entityupdate.scriptprocessor.XMLScriptProcessor" singleton="false"> <property name="entityHandlers"> <map> <entry key="attraction"> <ref bean="widgetProductSax" /> </entry> </map> </property> </bean> <bean id="widgetProduct" parent="transactionProxyTemplate"> <property name="target"> <bean class="com.travelgator.entityupdate.daoimpl.widgetXmlDaoImpl"> <property name="hibernateTemplate" ref="hibernateTemplate" /> <property name="errorLoggerFactory" ref="errorLogger" /> <property name="xmlScriptFile" value="widgetproducts.xml" /> </bean> </property> </bean> <bean id="widgetProducts" parent="transactionProxyTemplate"> <property name="target"> <bean class="com.travelgator.entityupdate.feeds.widget.widgetProducts"> <property name="hibernateTemplate" ref="hibernateTemplate" /> <property name="geographyNameUtil" ref="geographyNameUtil" /> <property name="widgetDao" ref="widgetProduct" /> <property name="xmlScriptFile" value="widgetproducts.xml" /> <property name="feedSchema" value="${stagingdb.schema}" /> <property name="productionSchema" value="${websitedb.schema}" /> <property name="bookingAgentId" value="${widget.agent.id}" /> <property name="processor" ref="widgetProductXmlScriptProcessor" /> <property name="scriptsLocation" value="${scripts.location}" /> <property name="scriptsCopyLocation" value="${scripts.copyLocation}" /> </bean> </property> </bean> <bean id="widgetLoader" parent="transactionProxyTemplate"> <property name="target"> <bean parent="transactionProxyTemplate"> <property name="target"> <bean class="com.travelgator.feedload.widget.widgetUSDLoader"> <property name="hibernateTemplate" ref="hibernateTemplateFeeds" /> </bean> </property> </bean> </property> </bean> <bean id="widgetXmlReader" class="com.travelgator.feedload.XMLReader"> <property name="widgetLoader" ref="widgetLoader" /> <property name="handler" ref="widgetLoader" /> </bean> <bean id="widgetStageFeed" parent="transactionProxyTemplate"> <property name="target"> <bean class="com.travelgator.feedload.StageFeedImpl"> <property name="xmlReader" ref="widgetXmlReader" /> <property name="hibernateTemplate" ref="hibernateTemplate" /> </bean> </property> </bean> <bean id="widgetFeedDownload" class="com.travelgator.feedload.FeedDownloader"> <property name="feedConfigFile" value="resources/conf/feedloadconfig.xml" /> <property name="flParser" ref="flParser" /> <property name="httpFileDownload" ref="httpFileDownload" /> <property name="ftpFileDownload" ref="ftpFileDownload" /> <property name="localFileDownload" ref="localFileDownload" /> <property name="stageFeed" ref="widgetStageFeed" /> </bean> </beans>


Reply With Quote