Had a quick look... the slow bit of code is likely this one:
https://github.com/geoserver/geoserver/blob/8c2d61ff931711bb59a24c4d69a21fd2b6cd91bf/src/main/src/main/java/org/geoserver/system/status/OSHISystemInfoCollector.java#L75
The OSProcess needs to be fetched in order to the updated info about CPU

There is a history of OSHI being slow on Windows
<https://github.com/oshi/oshi/issues/1029>. Some of the timings in there
are scary, 300ms spent on that
call are kind of crazy. Some of that slowness has been fixed, but I don't
know how much better it is now.
Reading the report,  the fix may be language-specific too, it's checking
for English keys in the registry,
and may not find them:
https://github.com/oshi/oshi/pull/1031/files#diff-17a8564424a7577c3745e77a61ffae5c10b4bc63d8a41de2d47635a964d14a2fR196

The loop is there to accumulate the CPU time spent by the JVM running
GeoServer process...
gets the info and sleeps for one second. Working 300ms and then sleep
1000ms is not exactly
"background" work indeed.
I guess we could make the sleep longer? Or have it configurable, even with
just a system variable?
Maybe have a longer default sleep time on Windows?

Cheers
Andrea





On Fri, Sep 17, 2021 at 4:00 PM Andrea Aime <
[email protected]> wrote:

> Ok, it is what I was expecting: OSHI.
> This is the thread that has accumulated more time on the CPU, as reported
> by the "cpu=121484.38ms" stat.
>
> "Thread-11" #91 prio=5 os_prio=0 cpu=121484.38ms elapsed=229.76s
> tid=0x000001d8ec5cd800 nid=0xa890 runnable  [0x00000069cd1fe000]
>    java.lang.Thread.State: RUNNABLE
> at com.sun.jna.Native.invokeInt(Native Method)
> at com.sun.jna.Function.invoke(Function.java:426)
> at com.sun.jna.Function.invoke(Function.java:361)
> at com.sun.jna.Library$Handler.invoke(Library.java:265)
> at com.sun.proxy.$Proxy109.WTSEnumerateProcessesEx(Unknown Source)
> at
> oshi.driver.windows.registry.ProcessWtsData.queryProcessWtsMapFromWTS(ProcessWtsData.java:85)
> at
> oshi.driver.windows.registry.ProcessWtsData.queryProcessWtsMap(ProcessWtsData.java:74)
> at
> oshi.software.os.windows.WindowsOperatingSystem.processMapToList(WindowsOperatingSystem.java:327)
> at
> oshi.software.os.windows.WindowsOperatingSystem.getProcess(WindowsOperatingSystem.java:304)
> at
> org.geoserver.system.status.OSHISystemInfoCollector.lambda$new$0(OSHISystemInfoCollector.java:75)
> at
> org.geoserver.system.status.OSHISystemInfoCollector$$Lambda$412/0x00000008008d4c40.run(Unknown
> Source)
> at java.lang.Thread.run([email protected]/Thread.java:829)
>
> Any OSHI expert around? Do we have to keep this thing running all the
> times (as opposed to, when the monitor tab is open?),
> If so, would it be possible:
>
>    - To drastically reduce its CPU consumption (I'm guessing it's polling
>    the system too much?)
>    - Ignore it and move on when hitting a platfom that is not supported?
>    (has happened a couple of times already)
>
> Cheers
> Andrea
>
> On Fri, Sep 17, 2021 at 2:48 PM Rahkonen Jukka (MML) <
> [email protected]> wrote:
>
>> Hi,
>>
>>
>>
>> Re-sending to correct developer list. I attach also the output from
>> jstack <pid>.
>>
>>
>>
>> -Jukka-
>>
>>
>>
>> *Lähettäjä:* Rahkonen Jukka (MML)
>> *Lähetetty:* perjantai 17. syyskuuta 2021 9.29
>> *Vastaanottaja:* '[email protected]' <[email protected]>
>> *Aihe:* Geoserver 2.20.RC generating high CPU load
>>
>>
>>
>> Hi,
>>
>>
>>
>> I installed and started GS 2.20 yesterday on Windows and now the
>> corresponding OpenJDK 11 process shows constant high CPU usage (12-17%).
>> Service is started at localhost:8080 and I do not generate any requests for
>> the service. I do not understand what happens and how to investigate the
>> situation. Any suggestions?
>>
>>
>>
>> -Jukka Rahkonen-
>> _______________________________________________
>> Geoserver-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>>
>
>
> --
>
> Regards,
>
> Andrea Aime
>
> ==
> GeoServer Professional Services from the experts!
>
> Visit http://bit.ly/gs-services-us for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions Group
> phone: +39 0584 962313
>
> fax:     +39 0584 1660272
>
> mob:   +39  333 8128928
>
> https://www.geosolutionsgroup.com/
>
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
> Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
> 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
> precisa che ogni circostanza inerente alla presente email (il suo
> contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
> riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
> messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
> operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
>
> This email is intended only for the person or entity to which it is
> addressed and may contain information that is privileged, confidential or
> otherwise protected from disclosure. We remind that - as provided by
> European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
> e-mail or the information herein by anyone other than the intended
> recipient is prohibited. If you have received this email by mistake, please
> notify us immediately by telephone or e-mail
>


-- 

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to