Nowadays, server power consumption and associated cooling cost have been a hot issue. Many people in Citrix and Citrix customers are asking what Citrix can do to help addressing this issue.
Here comes "Citrix Power Smart Utility for Presentation Server". Coming soon to CDN.
To read more about the project background and the thought process, please read more at my blog.
Stay tuned
Update:
The utility has been released to CDN. Here is the link
----
Hi my name is Ray Yang. I am a senior technical business development manager at Citrix. The new official Citrix blog site displays my name as Ruiguo Yang. But most people at Citrix refer me simply as Ray Yang. That was the name I used for the old community blog.
I haven't posted anything new recently because I've been busy working on an exciting new project called "Citrix Power Smart".
So what's "Citrix Power Smart"?
Nowadays, server power consumption and associated cooling cost have been a hot issue. Many people in Citrix and Citrix customers are asking what Citrix can do to help addressing this issue.
During a discussion with some members of the CTO Office team, a small group of us conceived the idea of powering off idle presentation server during off peak hours. Here is our thought process.
Just imagine you have 10 presentation servers. During the business hours they are fully utilized. However at nights or on weekends hardly anyone connects to them. These servers however still consume power needlessly during such "off business hours". Simply powering off such servers during "off business hours" can save you up to 30-50% of your presentation server farm power consumption based on our rough estimate. It sounds easy. But why haven't we found many people doing so? Many of them do want to save money and are environmentally conscious. We think one of the reasons is that it has to be made easy and reliably before such practice is widely adopted. Can you imagine the following scene?
A presentation server administrator stays late every night.
Wait for the last person to log off.
Shut down each idle server.
Get up early to power on all servers before everyone else comes to work.
It's a bit tough to do, isn't it?
Well, such repetitive work is best left for computers. And they can be programmed to do it reliably!
In fact, we realized that the existing presentation server and the underling server platforms have the necessary ingredients already. The existing Presentation Server SDK provides the ability to see what user sessions are running on a given presentation server. There are existing standards such as IPMI and infrastructure such as Windows Remote Management available to power on/off servers reliably. What's missing is a small piece of software to tie them together.
But wait a minute. What if some poor fellow do have to check emails or get some work done during the "off business hours"? You can leave some Presentation Servers running to serve them. However without additional work, the default Presentation Server load balancer will typically distribute the load evenly across all the servers preventing many servers to be shut down. To give you an example, say you have 10 servers in your farm. Each server is capable of supporting 50 concurrent user sessions. Based on historical data, you expect at most 30 concurrent user sessions will be needed during "off business hours". So I only need to keep one server running after business hour then. But wait. You have set up your presentation servers to balance user load evenly across your servers. These 30 user sessions will be spread across all 10 servers during "off business hours" preventing you from shutting them down. After all you don't want to lose your job because you disconnect your CEO's session when he is checking an important email at home.
So how can we improve our simple algorithm? Well, it turns out that Presentation Server has a "scheduling rule" for all the currently supported versions. You can define the time periods when certain servers are available. Perfect, we thought. If we add a simple scheduling rule, to make sure the servers we want to shut down aren't going to accept new connections in "off business hours", chances are much greater that these servers will have zero active sessions as people log off.
"Sounds great and simple. We have App Delivery Expo coming up next month. It's going to be a great talking point. Can you have it done, like tomorrow?" Marketing guys asked.
"Well, we like it but it is likely going to take XXX man weeks to go through the release cycle. And we are fully booked" answered development team.
Finally, the technical folks in the business development group volunteered to deliver the first version via Citrix Developer Network with forum support. Because of my developer background, I volunteered to lead the project. We volunteered because we love doing something good for the environment, sooner than later. And we believe once we showed the leadership and initiative, the community (users and partners) will help us get there even if the initial functionality is limited. And it is easier to convince the product team to include such features in the future releases once we have positive feedbacks from users. Personally it is gratifying to be able to contribute to something I believe in while getting paid ![]()
Thus "Citrix Power Smart for Presentation Server" project is born.
At this year's "App Delivery Expo" (AKA IForum), we announced "Power Smart" initiative. Here is the link to the press release. If this project is successful, we may bring more exciting projects under this model. For example, a Power Smart Utility for Xen. Since then we've got many interests from partners and customers. I may be able to share some more information on that subject later.
We know Presentation Server very well. But we are not the experts in controlling the physical servers such as powering on/off servers. Luckily we found some like-minded folks at one of our great partners HP to help us. HP's development team is busy too. But they gratefully provided advices and test equipments to allow us deliver a solution that will work with HP servers. And they happily agreed to do joint marketing with us. It's been a pleasure working with the HP team involved with this project so far.
I've been itching to share more information with Citrix community about this project. But I felt I had to get the utility working and release it on schedule first. I am still running some last minutes testing and getting feedbacks from selected beta users. It now looks promising that we will have the utility delivered to the community as a New Year gift from Citrix.
I will share more details with you as we make progress.
In the mean time, I'd love to hear from you, good or bad. If you prefer, you can also send an email to me at Ray.Yang@citrix.com. I can't promise to respond to every email. But I will try. For this reason, I would encourage you to comment on my blog or soon to be setup user forum to exchange your ideas with the broader community. Let's do something good, together!
I hope you find this blog interesting. And if you do, please help us spread the message.
Thanks!
If you're a developer that's looking for a simple web standards based interface to windows applications hosted on Citrix Presentation Servers you now have a new option beyond the existing MFCOM SDK. One of our partners Extentrix has released a product called Extentrix Web Services 2.0 - Application Edition which provides a suite of web services API's that communicate directly to the Citrix XML Service. The Web Service uses SOAP and XML to deliver information about CPS published apps, the developers app can then discover the web service's API's via WSDL and generate the appropriate proxy in order to deliver the app to the client.
Extentrix has an online TestDrive site that demonstrates a few examples of how this could be used; the sample page has an embedded link that when clicked first checks to see if the client has the required application locally installed, if so the content is redirected to natively launch locally. However, if the client does not have the app installed then the content is redirected to a CPS server and delivered ( launched ) via CPS/ICA.
Some additional use cases that we see for this include :
Enterprise portal integrations - If no CPS portlet exists or a unique implementation is desired - Extentrix also provides sample integration with Microsoft Share Point 2007.
Workflow - Enterprise work flows such as Oracle BPEL that can include launching the right app and the right document at the appropriate point in the workflow and maintain security of sensitive content.
Enterprise 2.0 Mashups - Now you can include all your existing windows apps in an enterprise mashup without completely rebuilding the app and UI.
So if this sounds interesting check it out and let us know what you think.
Developers can find more resources at this link
Chris Fleck
As promised in my previous blog. I am posting the webinar done by Dr.SDK on what's new in MFCOM SDK 4.5. The webinar explains the changes in the MFCOM application object and how you could publish a streaming application. The audio quality of the webinar is not the greatest in the world but I still think video is worth downloading to see Dr SDK explain useful examples.
I recently learned that CSEIT team has uploaded my CSEIT presentation on MFCOM SDK on support site. The presentation introduces MFCOM SDK and goes over some basic examples in VB script. If you are new to MFCOM SDK I would recommend you to download the presentation from support site. I am also going to upload webinars from Dr.SDK done last year on application publishing and MFCOM SDK 4.5. Check back later this week to watch those videos.
Welcome Citrix Developer Network (CDN) users! The CDN Web site has migrated to a new community-powered platform.Here are some of the notable sections of the Web site:
- CDN Blogs - Subscribe to the latest Citrix Software Development Kit (SDK) news. Read blogs from Citrix SDK experts writing about best practices and the future of the SDKs.
- [SDK Wiki] --Browse through SDK pages or download latest Citrix SDK's here.
- [Script Exchange] - Have a script you want to flaunt? Share your tools and scripts at Script Exchange or browse through dozens of sample scripts and tools.
- [Podcasts ]- Tune in to get insight on Citrix products. Listen to Citrix Engineering and Product Management members talk about new features and capabilities.
- CDN forums – Participate in SDK discussions at the CDN forums.
Check out the [CDN RSS page] and subscribe to the site's RSS feed. If you find something interesting on our site, don't forget to add or bookmark it to del.icio.us, Digg, or other social bookmarking sites. A good community site does not only focus on cool Web 2.0 technology it must also focus on its content and people. We would love to hear your thoughts about the site, which is why we have enabled anonymous comments. Please leave us feedback about the site and mention what you would like to see on the site in the future.
Here is a high level architecture diagram of MFCOM SDK and how the it work.

Currently mfreg is used to point to a specific Presentation server in a farm from the client machine. All the MFCOM calls get routed to that specific machine and talk to MFCOM running on that Presentation Server. This technique uses DCOM client machine defaults when it gets new MFCOM interfaces on that machine.
The main drawback with the above method is that it always points to only one server in the farm and you could potentially manage only one farm. What if you want to manage more than one farm by talking to more than one server in the same program? You can achieve this programmatically instead of using mfreg.
Basically it involves using the "servername" of the Presentation Server where MFCOM is running while creating objects and interfaces. We will look at how this could be achieved in C# and VBScript.
In C# :
These simple function in C# creates an interface of Type T on a server named "serverName".
object GetComObjectForServer<T>(string serverName)
{
try
{
Guid guid = typeof(T).GUID;
Type t = Type.GetTypeFromCLSID(guid, serverName, true);
return Activator.CreateInstance(t);
}
catch (Exception ex)
{
Trace.WriteLine(ex);
return default(T);
}
}
Once interface is created, then client security for that interface needs to be set. Pass in the above object to the method below to set the Client Security. Then you can use the interface and access its methods and properties.
void SetClientSecurity<T>(T obj)
{
if (obj == null)
throw new ArgumentNullException("obj");
IntPtr ptr = Marshal.GetComInterfaceForObject(obj, typeof(T));
if (ptr == IntPtr.Zero)
throw new ArgumentException("can't get COM interface for object", "obj");
int result = NativeMethods.CoSetProxyBlanket(
ptr,
10 /* RPC_C_AUTHN_WINNT */,
0 /* RPC_C_AUTHZ_NONE */,
pServerPrincName,
6 /* RPC_C_AUTHN_LEVEL_PKT_PRIVACY */,
3 /* RPC_C_IMP_LEVEL_IMPERSONATE */,
IntPtr.Zero,
0 /* NONE */);
Marshal.Release(ptr);
if (result < 0)
Marshal.ThrowExceptionForHR(result)
}
private class NativeMethods
{
private NativeMethods() { }
[DllImport("ole32.dll", PreserveSig = true, SetLastError = false)]
public static extern int CoSetProxyBlanket(
IntPtr pProxy,
int dwAuthnSvc,
int dwAuthzSvc,
IntPtr pServerPrincName,
int pAuthnLevel,
int pImpLevel,
IntPtr pAuthInfo,
int capabilities);
}
In VBScript (WSH):
To create an object on the remote machine in WSH just use the ServerName in CreateObject.
Set theFarm1 = CreateObject("MetaFrameCOM.MetaFrameFarm", ServerName1)
Set theServer1 = CreateObject("MetaFrameCOM.MetaFrameServer", ServerName1)
Set theFarm2 = CreateObject("MetaFrameCOM.MetaFrameFarm", ServerName2)
Set theServer2 = CreateObject("MetaFrameCOM.MetaFrameServer", ServerName2)
If ServerName1 and ServerName2 CPS Servers belong to two different Farms, then you have theFarm1 and theServer1 pointing to Farm1 and theFarm2 and theServer2 Objects pointing to Farm2.
These above mentioned techniques will help you to create MFCOM objects and interfaces on any CPS Server without restricting yourself to one CPS Server in a program pointed by mfreg. You still need to run mfreg to resgiter MFCOM on the client machine but you could either just register locally or even preferred CPS Server. The above mentioned methods ignore the server pointed by mfreg.