[squeak-dev] CPU of headless Squeak Image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] CPU of headless Squeak Image

Udo Schneider
All,

I'm currently trying to track why a Squeak Image uses so much CPU
resources constantly (>15%) on my linux box.

I'm running a vanilla image (3.10.2-7179) using the 3.10-4 Unix VM:

$ squeak -vm-sound-null -vm-display-null Squeak3.10.2-7179-basic.image

This gives a constant CPU rate of >15% on my Celeron 2.4 Ghz root server
(512 MB, CentOS 5).

Any pointers? Is there maybe a preconfigured image somewhere I'm not
aware of?

CU,

Udp


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] CPU of headless Squeak Image

Michael Rueger-6
Udo Schneider wrote:
> All,
>
> I'm currently trying to track why a Squeak Image uses so much CPU
> resources constantly (>15%) on my linux box.

Squeak usually takes about 2-5% in my experience (due to some polling
loops within the VM).

Make sure you have no UI windows open before you save the image, even in
headless state that can cause CPU usage.

Michael

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Udo Schneider
Michael Rueger schrieb:
> Squeak usually takes about 2-5% in my experience (due to some polling
> loops within the VM).
>
> Make sure you have no UI windows open before you save the image, even in
> headless state that can cause CPU usage.
Thanks for the hint - just tried this with no luck. :-(

I usually have an "Project uiProcess suspend" at the end of my startup
script - do I still have to close the windows then?

Just took a look at /config and it seems that IMHO the GC is running
quite often (two times a second). However even if I increase the heap it
stays with 15% ...

uptime 0h39m0s
memory 30,628,388 bytes
        old 26,569,316 bytes (86.7%)
        young 62,128 bytes (0.2%)
        used 26,631,444 bytes (87.0%)
        free 3,996,944 bytes (13.0%)
GCs 4,652 (503ms between GCs)
        full 2 totalling 1,496ms (0.0% uptime), avg 748.0ms
        incr 4650 totalling 15,179ms (1.0% uptime), avg 3.0ms
        tenures 18 (avg 258 GCs/tenure)

Any pointers?

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Udo Schneider
> Just took a look at /config and it seems that IMHO the GC is running
> quite often (two times a second). However even if I increase the heap it
> stays with 15% ...
I just moved the image(s) and startup scripts over to a windows box. And
... 0%-3% load. Same image, same startup script. The windows box is even
slower as this is a Vserver only. I'm baffled....

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] CPU of headless Squeak Image

Ryan Mitchley
In reply to this post by Udo Schneider
Get hold of OProfile (you'll need kernel headers) and see if anything sticks out. I'm not that familiar with the VM, so I don't know how useful the profiling will be. However, profiling is a lot better than guessing (it's taken me a while to accept that advice, myself!)

Ryan




Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Udo Schneider
Ryan Mitchley schrieb:
> Get hold of OProfile (you'll need kernel headers) and see if anything sticks
> out. I'm not that familiar with the VM, so I don't know how useful the
> profiling will be. However, profiling is a lot better than guessing (it's
> taken me a while to accept that advice, myself!)
Didn't know OProfile - I'll take a look at it. I just hope that the
kernel on the root server
can load the module.

CU,

Udo



Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Udo Schneider
In reply to this post by Udo Schneider
Udo Schneider schrieb:
> I just moved the image(s) and startup scripts over to a windows box. And
> ... 0%-3% load. Same image, same startup script. The windows box is even
> slower as this is a Vserver only. I'm baffled....
Just tried the exact same setup on Ubuntu Server and it works. CPU is
less than 2% even under heavy load. So I assume it must be something
with the CentOS 5 version on the rootserver ...

I'll rebuild the server from scratch with something different than CentOS 5.

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Andreas.Raab
Udo Schneider wrote:

> Udo Schneider schrieb:
>> I just moved the image(s) and startup scripts over to a windows box.
>> And ... 0%-3% load. Same image, same startup script. The windows box
>> is even slower as this is a Vserver only. I'm baffled....
> Just tried the exact same setup on Ubuntu Server and it works. CPU is
> less than 2% even under heavy load. So I assume it must be something
> with the CentOS 5 version on the rootserver ...
>
> I'll rebuild the server from scratch with something different than
> CentOS 5.

There must be something odd with that system. We run RHEL 5.2 on all of
our servers and see no such effect.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Udo Schneider
Andreas Raab schrieb:
> There must be something odd with that system. We run RHEL 5.2 on all of
> our servers and see no such effect.
I fully agree. This was a newly rebuilded CentOS5 System hosted at
1und1. So maybe they changed something on their own.

In addition as this was a brand new system I decided that rebuilding it
with something else is faster than me chasing bugs and maybe loosing
support because I have to change their base system somehow. The System
is currently rebuilded with openSuse 11. I'll keep you updated.

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: CPU of headless Squeak Image

johnmci
In reply to this post by Udo Schneider
well Project uiProcess suspend  deals with the Morphic UI process  
which is polling events from the UI event queue and running morphic  
subclass step cycles,

You can test the effect of doing a Project uiProcess suspend in a test  
image, you'll note all mouse interaction etc stops. So that is NOT  
consuming cpu cycles.


What you can do is attach to the running application with Gnu debug  
then stop it, and then invoke
call (int) printAllStacks()  and example the output, that will be the  
stack trace of all running processes.

They should all be waiting in some delay

except for the   idle loop process which will run from time to time to  
service async services via aioPoll()
The behaviour of this is tie to what should code you are using, you  
would need to look at the source code to see what the behaviour is
for your platform, I note there have been different versions over the  
years.  In general it *should* be waiting until the next smaltlalk  
delay expires or
an external interrupt comes in (clock signal, socket traffic, etc).  
Other code flavours if the wait time is < 10 ms might not wait, or  
maybe do a fixed amount of time.

BTW you will get GC work if you are executing smalltalk code, when,  
how often, and how long that takes is all a factor of the GC parms,
you data shows the incremental GC is executing every two seconds which  
is nothing for a GC rate, also it accounting for only 0.0003 % of  
clock time per second.


relinquishProcessorForMicroseconds: anInteger
        "Platform specific. This primitive is used to return processor cycles  
to the host operating system when Squeak's idle process is running  
(i.e., when no other Squeak process is runnable). On some platforms,  
this primitive causes the entire Squeak application to sleep for  
approximately the given number of microseconds. No Squeak process can  
run while the Squeak application is sleeping, even if some external  
event makes it runnable. On the Macintosh, this primitive simply calls  
GetNextEvent() to give other applications a chance to run. On  
platforms without a host operating system, it does nothing. This  
primitive should not be used to add pauses to a Squeak process; use a  
Delay instead."


On 18-Feb-09, at 6:53 AM, Udo Schneider wrote:

> Michael Rueger schrieb:
>> Squeak usually takes about 2-5% in my experience (due to some  
>> polling loops within the VM).
>> Make sure you have no UI windows open before you save the image,  
>> even in headless state that can cause CPU usage.
> Thanks for the hint - just tried this with no luck. :-(
>
> I usually have an "Project uiProcess suspend" at the end of my  
> startup script - do I still have to close the windows then?
>
> Just took a look at /config and it seems that IMHO the GC is running  
> quite often (two times a second). However even if I increase the  
> heap it stays with 15% ...
>
> uptime 0h39m0s
> memory 30,628,388 bytes
> old 26,569,316 bytes (86.7%)
> young 62,128 bytes (0.2%)
> used 26,631,444 bytes (87.0%)
> free 3,996,944 bytes (13.0%)
> GCs 4,652 (503ms between GCs)
> full 2 totalling 1,496ms (0.0% uptime), avg 748.0ms
> incr 4650 totalling 15,179ms (1.0% uptime), avg 3.0ms
> tenures 18 (avg 258 GCs/tenure)
>
> Any pointers?
>
> CU,
>
> Udo
>
>

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================




Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: CPU of headless Squeak Image

Udo Schneider
John M McIntosh schrieb:
> well Project uiProcess suspend  deals with the Morphic UI process which
> is polling events from the UI event queue and running morphic subclass
> step cycles,
So it seems it's at least no bad idea to keep it in my startup script.

> You can test the effect of doing a Project uiProcess suspend in a test
> image, you'll note all mouse interaction etc stops. So that is NOT
> consuming cpu cycles.
Did that ... in my working image ;-) Fortunately I saved a few minutes
before.

> What you can do is attach to the running application with Gnu debug then
> stop it, and then invoke
> call (int) printAllStacks()  and example the output, that will be the
> stack trace of all running processes.
I just finished installing openSuse 10.3 and now the same script/image
runs with 0.2%-2% CPU load. I'll try to recreate a VMWare with the
CentOS 5 image and start debugging

> They should all be waiting in some delay
>
> except for the   idle loop process which will run from time to time to
[...]
> is nothing for a GC rate, also it accounting for only 0.0003 % of clock
> time per second.
Thanks for the detailed info. Highly appreciated!

CU,

Udo