Results 1 to 4 of 4
Thread: Question about Multithreading !
- 03-27-2014, 01:35 AM #1
Senior Member
- Join Date
- Nov 2011
- Posts
- 165
- Rep Power
- 10
Question about Multithreading !
Suppose I am running 10 threads to grab a data(1000) from a database table located at one
IP Address and Insert it into another database located at different IP address.So how does this
multithreading decide the number of records each thread will carry out of 1000 records in the database?
- 03-27-2014, 02:28 AM #2
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: Question about Multithreading !
That is pretty much up to you. Threads are just programs that run concurrently. So you need to instruct each thread how and when to do network I/O to and from a database. There's no point in each thread reading the same records because it's inefficient. And I presume writing them concurrently to a DB could cause problems but I guess that depends on the DB. You need to sync their behavior so they don't clobber each other. And you also have to decide how many threads, if any, will improve the overall performance of the system, since that is usually the overall goal.
Caveat: I am a retired network engineer with a degree in CS who has minimal experience with data base management.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
- 03-27-2014, 02:51 AM #3
Senior Member
- Join Date
- Nov 2011
- Posts
- 165
- Rep Power
- 10
- 03-27-2014, 04:12 AM #4
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: Question about Multithreading !
I really don't know. I can assume it depends on a lot of factors. How many concurrent writes can you do? What's the B/W of the network path? It's sort of like if you can't completely empty one bucket before a second is full, then you only need two buckets. That's a very simplified analogy so others in this forum may offer some better guidance. And as far as profiling on Netbeans, I don't use that IDE.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
Similar Threads
-
Multithreading question about thread safety
By javajp in forum Threads and SynchronizationReplies: 0Last Post: 02-14-2013, 12:01 AM -
Multithreading question
By booboo0187 in forum Threads and SynchronizationReplies: 2Last Post: 01-31-2013, 09:55 PM -
Want to know about Multithreading.
By Chetans in forum Threads and SynchronizationReplies: 1Last Post: 03-19-2010, 08:50 AM -
Log 4j Multithreading
By joe2010 in forum Threads and SynchronizationReplies: 1Last Post: 01-31-2010, 04:48 AM
Bookmarks