Fast way to execute MySQL stored procedures in Java within multiple threads? -
what fastest option issue stored procedures in threaded environment in java? according http://dev.mysql.com/doc/refman/5.1/en/connector-j-usagenotes-basic.html#connector-j-examples-preparecall connection.preparecall() expensive method. what's alternative calling in every thread, when synchronized access single callablestatement not option?
the jdbc drivers use single socket per connection. think mysql use single socket. bad performance idea share 1 connection between multiple threads.
if use multiple connection between different threads need callablestatment every connection. need callabalestatement pool every connection. simplest pool in case wrap connection class , delegate calls original class. can create fast eclipse. in wrapped method preparecall() can add simple pool. need wrapped class of callablestatement. close method return callablestatement pool.
but first should check if call real expensive because many driver has such poll inside. create loop of preparecall() , close() , count time.
Comments
Post a Comment