Turbo CAM

As promised from my Immersion Week classes here are some ways to really help reduce the amount of work your Sun Ray Server does on bring up.  While we focused on CAM, all of these apply (except dtsession) to normal Sun Ray operations

Update:  We've found that the utprodinfo hack breaks normal sessions using NSCM (Mobile Sessions).  Do not use the utprodinfo hack for anything other than CAM.  It may also break other things that we are not yet aware of so use at your own risk.

In our case study we were trying to bring up 50 Sun Rays but were running into problems.  We started with a base line of 36 terminals coming up in about 30 minutes.  The box was so busy that certain calls in the cam script that did call backs to authd were timing out.  You could consider this the same as a cold restart or a massive shift change in a call center environment. 

Here are the magic 5 things you can do to tune CAM

(Thanks to those in Sun Ray Engineering who don't blog namely Sangeeta Varma and Ron Shipper)

What: Increase Authd worker threads from 8 to 32.

Why:  This is the target number of spare threads to maintain to handle new terminal connections.  When many sessions are starting up, we can exhaust authd fairly easily.  This can have a big effect on a Sun Ray Server that is servicing a lot of DTU's. 

How: Change the Workers = 8 to Workers = 32 in /etc/opt/SUNWut/auth.props

What: Change utprodinfo to do an echo vs. a pkginfo

NOTE:  This will break NSCM (i.e. non smart card mobile sessions).  Do not use if you are NOT running CAM for non-card sessions.

Why: While we currently only support installing Sun Ray Server Software in /opt, there are plenty of hooks to allow for future changes.  One of these is to query where the packages are installed.  This is done via pkginfo -r <package name> via a script called utprodinfo.  Consider that in order to just get to a login screen (i.e. dtgreet) eight pkginfo's are ran.  Multiply that by the number of DTU's you have, and the fact that pkginfo can be fairly taxing in itself and you have a recipe for wasted cycles.  Since we currently only support Sun Ray Server Software to be installed in /opt, we can change utprodinfo just echo out "/opt". 

How:  Make a copy of /opt/SUNWut/lib/utprodinfo

Find the line that reads:

r)     setOP "r";;

And change it to this:

#Tuning Fix - echo "/opt" and exit
r)     setOP "r" 
       echo "/opt" 

What: Use non-invasive methods for finding the Sun Ray MAC address or other information from the data store

Why:  If the Sun Ray Server is already taxed due to massive session creations, making calls to the data store that requires real time data from the session manager just worsens the situation.  A lot of folks use commands like utwho, utdesktop -Lc, utuser -lc, utdesktop -p, etc.  While these will return the desired information, if authd is too busy to service this request, it will time out.  If your CAM script relies on information from these queries, it will fail and cause your session to cycle.  This further exacerbates the problem of a taxed box.

How:  Check to see if the command you wish to use requires authd.  Open one window and truss the java process running authd.  Open another window and run your commands.  You should notice the changes to the truss.  Any command that gets current information or status information is going to make a callback to authd.  For example, utdesktop -lc will open authd, while utdesktop -l is just an ldap call.  Yes the -l will result in more information to parse through, but it does not rely on authd to readily service your request.  Most ut\* calls that call authd have a time out of 5000 ms.  utwho on the other hand does not seem to time out which could lead to CAM scripts hanging if authd is too busy.

Some folks also use these commands to figure out the MAC of the Sun Ray DTU.  Typically I've always recommended that people do a pwd on $UTDEVROOT, like so:

SRMAC=`cd $UTDEVROOT; pwd | sed 's/.\*\\(............\\)/\\1/'`

While that's a non-invasive command, it won't work if your Sun Ray is NAT'd.  Another method that will work in a NAT'd environment and is also non-invasive from a authd standport is to create a small script that queries the dispinfo files:

MYDISP=`echo $DISPLAY | awk -F: '{print $2}' | awk -F. '{print $1}'`
MYMAC=`grep TERMINAL /tmp/SUNWut/config/dispinfo/$MYDISP | awk -F. '{print $2}'`
echo $MYMAC

You can then use that script to set your variable.

What: Remove dtsession as a CAM application if not required.

Why: Not only does dtsession consume at least 30 MB of RAM per session (more for multihead), it takes cycles away from the CPU's and in most cases is not required.  If you are using CAM for full screen windows, dump dtsession.

How:  Remove dtsession from from the applications to launch selection under CAM.  Remember however that at least one application must be set to critical.  Dtsession usually fills this role, just remember to set on of your CAM applications to critical.

What: Increase the initial and max heap size for Authd

Why:  Under the 1.4 JRE, the max heap size will default to 64 MB.  Increasing this to 128 allows for more head room and will lower the number of times garbage collection occurs.  We find this setting to be a good balance between the number of times GC occurs and the amount of time GC takes.

How:  Make a copy of /opt/SUNWut/lib/utauthd and make the following changes:

Find the lines that read:


And add one more option:

JAVA_OPTS="-Xmixed -Xms128M -Xmx128M"

The end result of these changes? 

82 terminals up and logged into windows in 3 minutes from a cold restart of Sun Ray Services


Interesting... when will the Sun Ray server software be open sourced?

Posted by Mikael Gueck on November 21, 2006 at 04:33 PM PST #

[Trackback] craig bender blogs on reducing sun ray server load by setting some simple values in the sun ray config. this results in faster startup times. here’s a quick abstract on what the sun ray engineering guys did: Increase Authd worker threads from 8 ...

Posted by stotti.blog() on November 21, 2006 at 06:06 PM PST #

mikael, what do you want to do with an open-sourced sun ray source? as far as i know you can already get a copy via a sun partner agreement... right, craig?

Posted by stotti on November 21, 2006 at 06:32 PM PST #

That's a question that I cannot answer. Try Jonathans blog.

Posted by ThinGuy on November 22, 2006 at 12:00 AM PST #


I am trying not to change topic but it is somehow related to using CAM with Windows Server 2003...

How do I go about contacting whoever is in charge of Windows Hardware Quality (WHQL) certification @ Sun? From this website Microsoft® Windows® on Sun x64 Systems, I see that the X4600 is NOT certified for 2003 Datacenter edition. Why not??? I beg them to please submit and certify this system, and maybe the X4500

I also saw that you have mentioned a related thing in your July 2006 post titled 'The most kick-ass Citrix/Terminal Server on Earth'.

From another comment by 'gblahaerath', titled Sun Fire <heart> Longhorn, it is probable that X4600 or X4500 will easily pass WHQL certification...

Please can you forward this to the relevant people?


Posted by Amit Kulkarni on November 22, 2006 at 03:56 PM PST #

Amit, You are preaching to the choir. The problem with Datacenter edition, is that it has to come from the manufacturer of the server, i.e. Sun. Since Sun does not resell Microsoft products, this is not possible. But I agree, we should support this. However, it does see all the cores....I had an addition problems. It just doesn't see all the RAM.

Posted by ThinGuy on November 22, 2006 at 11:55 PM PST #

That is a 'Good Thing to Know'. I didn't exactly know if MS refers to 8-way as 8 cores or 8 sockets, thanks to you I now understand that they refer to 8 sockets, same as Sun. I guess that if the dual cores are replaced by quad cores, EE 2003 will also 'see' those extra cores.

Thanks for updating that other link.

Posted by Amit Kulkarni on November 23, 2006 at 09:00 AM PST #

Does this still count today and can it be used with 4.0u3? (4.1)?


Posted by Alex Green on August 20, 2008 at 09:40 PM PDT #

Hi Alex,
Yes, most still apply, mainly increasing authd threads, not using a windowing manager (our SRWC Kiosk session descriptor does not use one), and still using non-invasive ways to find out things like MAC's.

Posted by Thin Guy on August 21, 2008 at 02:05 AM PDT #

Post a Comment:
Comments are closed for this entry.

Think Thin is a collection of bloggers that work with Oracle's Virtual Desktop portfolio of products.


« July 2016