Hi Ryan,
Your example fails to take into account the cost of swapping
threads in and out of swap space. You're simulating databases running a
query and going to sleep forever, which is not realistic. I'm thinking
of something along the lines of databases running a query every X
seconds where X is a random value from 15 to 30 seconds. The cost of
swapping threads in and out of swap is a lot more expensive than the use
of a thread pool in this case.
Gili
On 19/02/2012 11:33 AM, Ryan How wrote:
Maybe the OS or something is smarter than it seems... I've had
thousands of open threads and memory stays a lot lower than 1MB /
thread. If it didn't my little laptop would chug!
I just ran a test then...
public static void main(String[] args) {
for (int i = 0; i < 1000; i++) {
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(100000000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
}
Windows Task Manager reports memory at 50,476K
Swap space rose by 70MB.
I mean, it is a little high for a program that does nothing, but it
isn't 1GB!
On 19/02/2012 5:42 AM, cowwoc wrote:
# The default stack size for threads under 64-bit JVMs is 1MB. Source:
http://www.oracle.com/technetwork/java/hotspotfaq-138619.html
# At 64-bit with 512k stack (notice, this is smaller than the default)
he is still limited to 32k threads and a whopping 16GB of memory gets
used. You never even more memory to keep the heap around.
--
You received this message because you are subscribed to the Google
Groups "H2 Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.