multithreading - Can mutli-threading java client cause high CPU utilization of SQL Server 2008? -


i java developer, not dba, , consult issue encountered in high cpu utilization in sql server 2008 (not in java app server).

the java client uses multi-threading, simplify:

  1. 40 threads each select / insert / update (simple sql statements) table x - autocommit on
  2. 10 threads each select / insert / update (simple sql statements) table y , selects (again simple) table x (to check existence) - autocommit on

both set of threadpools run simultaneously. each thread assigned "message queue" (a file), loads / reads assigned "message", , inserts / updates corresponding table. these 2 thread pools connections single connection pool via datasouce, example:

    <resource auth="container" driverclassname="com.microsoft.sqlserver.jdbc.sqlserverdriver" maxactive="100" maxidle="10" maxwait="10000" name="jdbc/abc_datasource" password="p" type="javax.sql.datasource" url="jdbc:sqlserver://ntxxx\\instyyy:12345;databasename=dbzzz" username="u"/> 

the db environment sql server 2008 r2 , shared other apps, java client above flagged causing cpu utilization. when java client shutdown, utilization stabilized. java client's application server jboss, statistics java running not have performance issues, cpu , memory fine; db server got cpu spiked.

my question is, high amount of threads, consume datasource's pool of maxactive 100, potentially cause? if so, how can prove this db perspective, ie. sql server statistics pointing high volumne threads java client?

posted in dba stack, not getting views...: https://dba.stackexchange.com/questions/96502

your description generic give detailed answer. nevertheless, simple statements can cause substantial database activity, if database has either plenty of values or no matching indexes , needs fall full table scans each select.

so, first suggestion is, use sql studio application activity analyzer. there find current load on machine and, more important, list of "currently valuable queries". list queries, responsible current cpu load. see queries executed often, take little time per execution , see queries executed few times, extremely expensive execute.

you can evaluate queries java application , optimization hints. helpful.

the other point is, if queries cannot optimized, maybe data inserted expensive handle (for example blob objects) or sql server not powerful enough handle amount of rows amount of memory , other applications running @ same time.

if cannot solve issue on query side, may need inspect code, if can throttle db load implementing queueing mechanism in between or if need implement caching layer.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -