AW: AW: Tomcat dedicated server

2022-01-20 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hi Chris,

ah.. yes. You are right, I overlooked the available 16 GB Ram.
Long time ago, when I used a physical server with 16 GB but in cloud 
environment, ram is money.

Greetings,
Thomas

-Ursprüngliche Nachricht-
Von: Christopher Schultz  
Gesendet: Donnerstag, 20. Januar 2022 13:01
An: users@tomcat.apache.org
Betreff: Re: AW: Tomcat dedicated server

Thomas,

On 1/20/22 04:16, Thomas Hoffmann (Speed4Trade GmbH) wrote:
> just one remark: Take care about the 32 GB. Configuring more than 32 GB, the 
> Java Pointers will use 64 Bit and thus need double the space.
> Thus 34 GB memory can be worse than 31 GB.
> See also 
> https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-me
> mory-oddities/
> 
> Just my 2 cents.

While this is indeed true (and can be surprising), it is not relevant. 
Nobody with 16GiB of physical memory has any business attempting to use a 32GiB 
heap.

-chris

> -Ursprüngliche Nachricht-
> Von: Olaf Kock 
> Gesendet: Donnerstag, 20. Januar 2022 09:54
> An: users@tomcat.apache.org
> Betreff: Re: Tomcat dedicated server
> 
> Hi Lance
> 
> On 19.01.22 23:35, Campbell, Lance wrote:
>> On a Tomcat 9.x dedicated Linux server with 16G of memory, how much memory 
>> would you allocate for the OS?
>>
>> Assume there is no file processing taking place.  Also assume Tomcat is 
>> communicating primarily with a PostgreSQL database and Apache web server 
>> each running on their own dedicated servers.  The Tomcat application server 
>> is the only thing running on the Linux server.
> 
> It depends (TM)
> 
> Without knowing your application, the load (e.g. number of concurrent
> users) and general setup, there's no way to tell. I'd rather handle 
> the question the other way around: How much memory does (your 
> application
> on) Tomcat require. Tomcat itself is happy with just a little bit of memory, 
> but applications vary widely. Also, some applications are memory-bound, some 
> are I/O-bound, some are CPU-bound. So memory might not be your bottleneck to 
> worry about.
> 
> You should load-test your application with a realistic load (plus
> margin) and keep an eye on memory consumption. But in the end you'll find out 
> what is the first bottleneck to appear. It might not be memory.
> 
> But to come back closer to your original question: I recommend to 
> deactivate swapspace for production servers, and configure -Xms equal 
> to -Xmx, so that you find shortages of memory early (when you start 
> the
> application) rather than Sunday night at 3am. You might want to leave 
> 1-2G for the OS and start testing this way, or rather test how little 
> memory your app requires to run and add margin. My rule of thumb is: 
> The more memory there is to be claimed in GC, the longer a full GC run 
> takes. Often, many short but frequent GC runs are preferable to fewer 
> but longer lasting. (I didn't check if this still applies to the newer 
> generation of garbage collectors, so take this GC-statement with a 
> grain of salt)
> 
> Olaf
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat dedicated server

2022-01-20 Thread Christopher Schultz

Mark,

On 1/20/22 04:18, Mark Thomas wrote:

On 20/01/2022 08:54, Olaf Kock wrote:


 My rule of thumb is: The
more memory there is to be claimed in GC, the longer a full GC run
takes.


Nope.

The time a GC run takes is proportional to the size of objects in memory 
that do not need to be GC'd. GC walks the active object tree so it is 
the active objects that matter.


Doesn't this depend upon which "space" is being cleaned? The young 
generations (by whatever name, depending upon the GC engine being used) 
work this way, but the "older" generations usually have to be "cleaned" 
(rather than "prompted and abandoned"). But of course, the older 
generations typically have far less garbage to be collected than the 
younger generations which have large numbers of allocations and 
deallocations all the time.


Generally, the more memory you give the JVM to work with, the lower the 
impact of GC for both pauses and throughput.


A rule of thumb I have seen in the past (may be out of date for current 
JVMs) is that the JVM needs roughly 5x the steady state memory 
requirements for GC to work most efficiently.


That's an interesting anecdote; it seems like a very large factor to me.

Something else Olaf said is worth repeating: setting -Xms and -Xmx to 
the same value for a server process is a good idea, otherwise the memory 
spaces will have to be periodically re-organized and expanded which just 
waste resources.


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: AW: Tomcat dedicated server

2022-01-20 Thread Christopher Schultz

Thomas,

On 1/20/22 04:16, Thomas Hoffmann (Speed4Trade GmbH) wrote:

just one remark: Take care about the 32 GB. Configuring more than 32 GB, the 
Java Pointers will use 64 Bit and thus need double the space.
Thus 34 GB memory can be worse than 31 GB.
See also 
https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-memory-oddities/

Just my 2 cents.


While this is indeed true (and can be surprising), it is not relevant. 
Nobody with 16GiB of physical memory has any business attempting to use 
a 32GiB heap.


-chris


-Ursprüngliche Nachricht-
Von: Olaf Kock 
Gesendet: Donnerstag, 20. Januar 2022 09:54
An: users@tomcat.apache.org
Betreff: Re: Tomcat dedicated server

Hi Lance

On 19.01.22 23:35, Campbell, Lance wrote:

On a Tomcat 9.x dedicated Linux server with 16G of memory, how much memory 
would you allocate for the OS?

Assume there is no file processing taking place.  Also assume Tomcat is 
communicating primarily with a PostgreSQL database and Apache web server each 
running on their own dedicated servers.  The Tomcat application server is the 
only thing running on the Linux server.


It depends (TM)

Without knowing your application, the load (e.g. number of concurrent
users) and general setup, there's no way to tell. I'd rather handle the 
question the other way around: How much memory does (your application
on) Tomcat require. Tomcat itself is happy with just a little bit of memory, 
but applications vary widely. Also, some applications are memory-bound, some 
are I/O-bound, some are CPU-bound. So memory might not be your bottleneck to 
worry about.

You should load-test your application with a realistic load (plus
margin) and keep an eye on memory consumption. But in the end you'll find out 
what is the first bottleneck to appear. It might not be memory.

But to come back closer to your original question: I recommend to deactivate 
swapspace for production servers, and configure -Xms equal to -Xmx, so that you 
find shortages of memory early (when you start the
application) rather than Sunday night at 3am. You might want to leave 1-2G for 
the OS and start testing this way, or rather test how little memory your app 
requires to run and add margin. My rule of thumb is: The more memory there is 
to be claimed in GC, the longer a full GC run takes. Often, many short but 
frequent GC runs are preferable to fewer but longer lasting. (I didn't check if 
this still applies to the newer generation of garbage collectors, so take this 
GC-statement with a grain of salt)

Olaf



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat dedicated server

2022-01-20 Thread Christopher Schultz

Lance,

On 1/19/22 17:35, Campbell, Lance wrote:

On a Tomcat 9.x dedicated Linux server with 16G of memory, how much
memory would you allocate for the OS?

Assume there is no file processing taking place.  Also assume Tomcat
is communicating primarily with a PostgreSQL database and Apache web
server each running on their own dedicated servers.  The Tomcat
application server is the only thing running on the Linux server.


You need to provide a lot more information.

Some application servers can get away with a tiny amount of memory --
say, 64 megabytes of heap space -- and others needs many gigabytes.

Are you maintaining large caches of objects? Are you handling large
result sets from your database where those results need to temporarily
reside in memory? Do you expect large numbers of logged-in users with
HttpSession object which contain large amounts of stuff?

If none of the above are true, you may not need very much of that 16GiB
of RAM you have there.

At $work, we run application servers which have 8GiB of physical RAM and 
we run 4 separate JVM+Tomcat+application instances on each of them. The 
application with the largest heap space is set to 640MiB. We have 
several hundred users logged-in on each node at any given time and we 
have plenty of heap space.


Only *you* can tell what kind of memory requirements your application 
has. Usually "more is better" but sometimes, "more" just adds 
unnecessary costs.


If you only have OS + JVM/Tomcat/application running on this machine, I 
would set your heap to something conservative like 8GiB and monitor the 
application over time: see what memory-load your users are putting on 
it. SAVE YOUR DATA OVER TIME! If you see a saw-tooth pattern of 
used-heap (which is great!), look at the minimum value of that sawtooth 
pattern over time and that's essentially the minimum memory you need. 
Whatever you add on top of that gives you room to expand to more 
concurrent users, or handle larger temporary memory-usage scenarios, 
such as collating a large data set in memory (instead of having the 
database do it for you, for example).


Hope that helps,
-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat dedicated server

2022-01-20 Thread Olaf Kock
Hi Mark

On 20.01.22 10:18, Mark Thomas wrote:
> On 20/01/2022 08:54, Olaf Kock wrote:
>
>>  My rule of thumb is: The
>> more memory there is to be claimed in GC, the longer a full GC run
>> takes.
>
> Nope.
>
> The time a GC run takes is proportional to the size of objects in
> memory that do not need to be GC'd. GC walks the active object tree so
> it is the active objects that matter.
>
> Generally, the more memory you give the JVM to work with, the lower
> the impact of GC for both pauses and throughput.
>
> A rule of thumb I have seen in the past (may be out of date for
> current JVMs) is that the JVM needs roughly 5x the steady state memory
> requirements for GC to work most efficiently.
>
Thank you for setting my ancient rule of thumb straight - noted and
mentally corrected, this is really useful.

Obviously, the last time that I needed to squeeze the last bit of
performance out of a machine is so old that I never needed to revert
that ancient rule of thumb - now I have a cause to do so.

@Lance: I take it back and claim the opposite :)

Olaf


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat dedicated server

2022-01-20 Thread Mark Thomas

On 20/01/2022 08:54, Olaf Kock wrote:


 My rule of thumb is: The
more memory there is to be claimed in GC, the longer a full GC run
takes.


Nope.

The time a GC run takes is proportional to the size of objects in memory 
that do not need to be GC'd. GC walks the active object tree so it is 
the active objects that matter.


Generally, the more memory you give the JVM to work with, the lower the 
impact of GC for both pauses and throughput.


A rule of thumb I have seen in the past (may be out of date for current 
JVMs) is that the JVM needs roughly 5x the steady state memory 
requirements for GC to work most efficiently.


Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



AW: Tomcat dedicated server

2022-01-20 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello Lance,

just one remark: Take care about the 32 GB. Configuring more than 32 GB, the 
Java Pointers will use 64 Bit and thus need double the space.
Thus 34 GB memory can be worse than 31 GB.
See also 
https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-memory-oddities/

Just my 2 cents.

Greetings, Thomas

-Ursprüngliche Nachricht-
Von: Olaf Kock  
Gesendet: Donnerstag, 20. Januar 2022 09:54
An: users@tomcat.apache.org
Betreff: Re: Tomcat dedicated server

Hi Lance

On 19.01.22 23:35, Campbell, Lance wrote:
> On a Tomcat 9.x dedicated Linux server with 16G of memory, how much memory 
> would you allocate for the OS?
>
> Assume there is no file processing taking place.  Also assume Tomcat is 
> communicating primarily with a PostgreSQL database and Apache web server each 
> running on their own dedicated servers.  The Tomcat application server is the 
> only thing running on the Linux server.

It depends (TM)

Without knowing your application, the load (e.g. number of concurrent
users) and general setup, there's no way to tell. I'd rather handle the 
question the other way around: How much memory does (your application
on) Tomcat require. Tomcat itself is happy with just a little bit of memory, 
but applications vary widely. Also, some applications are memory-bound, some 
are I/O-bound, some are CPU-bound. So memory might not be your bottleneck to 
worry about.

You should load-test your application with a realistic load (plus
margin) and keep an eye on memory consumption. But in the end you'll find out 
what is the first bottleneck to appear. It might not be memory.

But to come back closer to your original question: I recommend to deactivate 
swapspace for production servers, and configure -Xms equal to -Xmx, so that you 
find shortages of memory early (when you start the
application) rather than Sunday night at 3am. You might want to leave 1-2G for 
the OS and start testing this way, or rather test how little memory your app 
requires to run and add margin. My rule of thumb is: The more memory there is 
to be claimed in GC, the longer a full GC run takes. Often, many short but 
frequent GC runs are preferable to fewer but longer lasting. (I didn't check if 
this still applies to the newer generation of garbage collectors, so take this 
GC-statement with a grain of salt)

Olaf



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat dedicated server

2022-01-20 Thread Olaf Kock
Hi Lance

On 19.01.22 23:35, Campbell, Lance wrote:
> On a Tomcat 9.x dedicated Linux server with 16G of memory, how much memory 
> would you allocate for the OS?
>
> Assume there is no file processing taking place.  Also assume Tomcat is 
> communicating primarily with a PostgreSQL database and Apache web server each 
> running on their own dedicated servers.  The Tomcat application server is the 
> only thing running on the Linux server.

It depends (TM)

Without knowing your application, the load (e.g. number of concurrent
users) and general setup, there's no way to tell. I'd rather handle the
question the other way around: How much memory does (your application
on) Tomcat require. Tomcat itself is happy with just a little bit of
memory, but applications vary widely. Also, some applications are
memory-bound, some are I/O-bound, some are CPU-bound. So memory might
not be your bottleneck to worry about.

You should load-test your application with a realistic load (plus
margin) and keep an eye on memory consumption. But in the end you'll
find out what is the first bottleneck to appear. It might not be memory.

But to come back closer to your original question: I recommend to
deactivate swapspace for production servers, and configure -Xms equal to
-Xmx, so that you find shortages of memory early (when you start the
application) rather than Sunday night at 3am. You might want to leave
1-2G for the OS and start testing this way, or rather test how little
memory your app requires to run and add margin. My rule of thumb is: The
more memory there is to be claimed in GC, the longer a full GC run
takes. Often, many short but frequent GC runs are preferable to fewer
but longer lasting. (I didn't check if this still applies to the newer
generation of garbage collectors, so take this GC-statement with a grain
of salt)

Olaf



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Tomcat dedicated server

2022-01-19 Thread Campbell, Lance
On a Tomcat 9.x dedicated Linux server with 16G of memory, how much memory 
would you allocate for the OS?

Assume there is no file processing taking place.  Also assume Tomcat is 
communicating primarily with a PostgreSQL database and Apache web server each 
running on their own dedicated servers.  The Tomcat application server is the 
only thing running on the Linux server.

Thanks,

Lance