603D: The Ultimate XenDesktop 5.x Troubleshooting Workshop Fred Donovan Senior Support Product Manager Rene Alfonso Architect, Technical Support May 2012 Session Topics Brief Architectural Review XenDesktop Troubleshooting Lab VDA High Availability Mode Lab XenDesktop 5.x Database Lab Personal vDisk Troubleshooting Lab Next Generation Support: TaaS Brief Architectural Review XenDesktop The XD DDC Core Architecture 4.x XenDesktop 5.x Controller Services HTTP 80, 443 WI Pool Machine Manager Creation XML Broker Service IMA Machine Identity Licensing DDC Servers 8080 4.x 80 5.x PC) Desktop (VM or blade PortICA Service Svc License Server ADO Data Store ICA 1494 PortICA Drivers 2512 Domain Controller VDA Workstation (VM or blade PC) Workstation (VM or blade PC) Controller AD Identity Service Configuration Host VM Host CGP Svc CGP 2598 Client (via AG) Broker Services XenDesktop 4: XenDesktop 5: 443 80 SSL XML 443 80 IMA CDS Pool Management Broker Service Database Management XML components Hosting Management PowerShell SDK VDA Management Licensing New Desktop Delivery Controller (XD5.x) • IMA Service is replaced by various .NET services communicating over Windows Communication Foundation (WCF) • New relational SQL database • No controller to controller communication each controller talks to the database SQL Database DDC1 DDC2 Controller 5.x Roles & States • Controllers no longer hold state information; it is now located in the database Controller #1 • No Local Host Cache • Hypervisor connection maintained by one controller (Get-BrokerHypervisorConnection) Controller #2 Database High-level Service-Oriented Architecture Desktop Studio Desktop Director WinRM (WMI) PowerShell WCF SDK available for automation Desktop Delivery Controller Configuration Service Host Service Broker Service Machine Creation Service AD Identity Service Virtual Desktop Machine Identity Service SQL Server VDA Registration (CTX126704) Allows Broker to control VDA 3 Strikes before VDA is placed in Maintenance Mode (MaxFailedRegistrationsAllowed) After a period of time (20 Min) unsuccessfully registered VDA shutdown (MaxRegistrationDelayMin) Power Management Open TCP Ports VDA Registry Based Registration VDA initiates initiates communication communicationover overWCF WCFand andprovides providesits itsSID SID VDA VDA BrokerVerifies verifies Computer computer AD AD Object object Broker Brokerthen then communicates communicates directly directly to to VDA VDA Broker Broker Brokerverifies verifiesthe theVDA VDAinin database database sends and sendsand configuration information information Registration Success Results Registration completes successfully Controller Broker service and VDA registration (XD5.x) • Registry based VDA registration from ListofDDCs registry key on the VDA Registration Types: • Uses WCF/ Soft Connection – sets up minimal Brokering ping support Protocol to maintain heartbeat Hard – fully configures the VDA with desktop group membership • Validates VDA, test call-back and writes state into database • VDA broker service role handles launch sequence, status updates and session control Under The Hood: VDA Registration (Active Directory) DDC Server VDA WCF VDA Desktop Service DDC Service looks up VDA computer account Service starts and looks up the farm OU in the registry DDC checks that computer account (SID) is valid in AD Service queries DC for all Service Connection Point objects (DDCs) in that OU Service selects one DDC at random, looks up DDC computer account and initiates a connection through WCF Broker Service LDAP Controller initiates WCF connection to VDA (using peer IP address and Kerberos ticket) OS retrieves Kerberos ticket for DDC Controller validates that caller is member of “Controllers” group, and sets configuration DDC service receives connection (Kerberos prevents man-in-the-middle) Connection succeeds and VDA is marked registered AD CDF Tracing and CDF Control Introduction to Citrix Diagnostic Facility Tracing What is CDF tracing? • A unified debug tracing system integrated into various Citrix products XenDesktop, XenApp, Receiver • It is high performance tracing, supported by the Microsoft OS (ETW) • It allows various components, such as DLL’s, EXE’s and drivers to be traced • A single architecture that an Engineer can leverage to troubleshoot problems Introduction to CDFControl (CTX111961) • A GUI based CDF trace capture and analysis tool was developed • Expert Control Feature Expert Control • Expert Control finds the messages that are *meaningful* • Known issues are automatically flagged • Knowledge Base articles are automatically launched XDPing Tool (CTX123278) • Can be run on both the DDC and VDA to troubleshoot registration issues • Used to collect data related to basic components • Will verify if the components are working correctly • Verify Domain Membership • Network Interfaces • WCF Endpoints • Services • DNS lookup • Time difference between machine and Domain Controller Troubleshooting Tips for VDA Registration Issues • Check Domain Membership /Time Synchronization • Check value under HKLM\Software\Citrix\VirtualDesktopAgent\ListOfDDCs • Check Citrix Desktop Service warnings and errors • Look under Error Details for the exact condition • Get-BrokerDesktop -MachineName DOMAIN\MACHINE • LastDeregistrationTime LastDeregistrationReason VALUES • See CTX117248 for details Lab #1 VDA Registration Troubleshooting Lab Environment URL http://training.citrixsynergy.net/ Class Code: <Provided by Instructor> Requirements Latest Citrix ICA Client Citrix Scout / XD Collector (CTX130147) Push button easy data collection system • Makes data collection and upload push button easy • Integrates data collected by Scout with the Citrix Tools as a Service (TaaS) backend • Simplifies data collection & analysis HDX Monitor 2.x (CTX123058) • VDA User Experience Monitoring • Diagnostics • Configuration • Performance • Remote VDA Monitoring 2.x • Available for XD5.x XA 6.x Lab #2 HDX Monitor XD PowerShell SDK • XenDesktop 5 built on PowerShell • Desktop Studio PowerShell Tab • Citrix Developer Network • http://www.citrix.com/cdn • Code Share • SDK Documentation Checking Broker State PowerShell for troubleshooting • Add-PSSnapin citrix* • Get-BrokerServiceStatus Returns OK if broker service is responding to requests • Get-BrokerDBConnection Displays SQL connection information • Get-ConnectionLog *New in XD 5.6 Displays user connection history both success and failures Lab #3 PowerShell XenDesktop 5.x VDA High Availability Mode ICA File Dedicated Virtual Desktop ICA Ports 1494 2598 VDA Registration SQL Database Controller1 Controller2 XenDesktop 5 HA Mode (CTX127392) • VDA can operate in high availability mode if all controllers fail in a XenDesktop 5 site • Dedicated Desktops Only • Registry enabled – HighAvailability REG_DWORD 1 • Configurable time period (default 5 minutes) • Must register with controller within 30 days • Prompt for password EnforceAutoLogon REG_DWORD 0 HA Mode Demo / Lab • Citrix Desktop Service • Event ID 1014 controller communication failure • Event ID 1012 controller communication success • CDF Trace Event (on VDA) • CdsWorkerAgent:2:1:Register FAILURE: HighAvailabilityActive = True, InHighAvailabilityMode = True, _firstRegistrationAttemptTime = xx/xx/xxxx xx:xx:xx, HighAvailabilityRegistrationTimout = 00:05:00 • ICA File • http://support.citrix.com/article/ctx127392 Lab #4 VDA HA Mode XenDesktop 5.x Database Overview Support Database System Requirements • Microsoft SQL Server 2008 R2 (SP1 supported) • Microsoft SQL Server 2008 w/SP1 or later • Microsoft SQL Server 2008 R2 Express Edition (on media, SP1 supported) • Microsoft SQL Server 2012 (see CTX132438) • Supported Databases For Citrix Products CTX114501 Database sizing information (1 of 2) • It’s important to consider DB sizing during initial setup of an environment • Sizing depends on several factors • # of registered VDAs • # of connected sessions • Connection rate • # of managed desktops • # of provisioned desktops Database sizing information (2 of 2) • A formula from the test teams has produced the following data CTX127939 Provisioned Desktops Using MCS 5,000 10,000 20,000 Unmanaged Desktops Per Worker (KB) 14,500 29,000 58,000 Per Session (KB) 25,500 51,000 102,000 Per Connection (KB) 840 1,680 3,360 Per AD Account (KB) 9,000 18,000 36,000 Per MCS machine (KB) 9,700 19,400 38,800 59 117 233 Approx. Total (MB) 5,000 10,000 20,000 Per Worker (KB) 14,500 29,000 58,000 Per Session (KB) 25,500 51,000 102,000 Per Connection (KB) 840 1,680 3,360 Approx. Total (MB) 40 80 160 Database schemas • Schemas are a type of container used to organize database objects and permissions • Multiple SQL schemas exist in the database ADIdentitySchema Chb_Config(broker) Chb_State (broker) ConfigurationSchema DesktopUpdateManagerSchema HostingUnitServiceSchema MachinePersonalitySchema • Schemas map to the Windows services on the Controller How controllers connect to the DB Controller 2 Controller 1 SQL Login domain\Broker1$ DB User domain\Broker1$ SQL Login domain\Broker2$ DB Roles Tables + SPs XD5 Database SQL Server Instance DB User domain\Broker2$ Database Security (CTX127998) • SysAdmin rights needed for special administrative operations • Each database user maps to database roles with specific rights to corresponding objects • ADIdentitySchema_ROLE • DesktopUpdateManagerSchema_ROLE • Chr_Broker • HostingUnitServiceSchema_ROLE • Chr_Controller • MachinePersonalityServiceSchema_ROLE • ConfigurationSchema_ROLE Database Activity • Live session state held in database, including registration info • One transaction per desktop for health ‘ping’ • Default period 30 seconds per desktop • Small # of transactions per desktop launch • Automatic database clean-up (purge stale records) • Controller health heartbeat • Loss of database access = dead broker • No heartbeat other brokers will take over responsibilities Database Maintenance and Troubleshooting Monitoring SQL Connections BrokerService Controller SQL Connections Citrix.ADIdentity.SdkWcfEndPoint SQL Activity Monitor Citrix.Configuration.SdkWcfEndPoint Citrix.MachineCreation.SdkWcfEndPoint Right Click SQL Server Activity Monitor Citrix.Host.SdkWcfEndPoint Citrix.Identity.SdkWcfEndPoint Performance Counters • Database Avg Transaction Time • Database Connected • Database Transaction/sec • Database Transaction Error/sec • Brokered Sessions Managing the transaction log (1/2) • A transaction log is the recording of all changes performed against a database • Recovery model options • Simple – Reclaims log space but can only recover to the last backup (default option for XD5 database) • Full – Can recover to any point in time but requires the most disk space Managing the transaction log (2/2) • Average transaction log sizing formula • A VDA with no activity generates approximately 62KB of transaction log data per hour • # of VDAs X 24 Hours X Approx. 62KB of data • 100 VDAs X 24 Hours X 62KB = 145MB • Set the log to a fixed size and backup the log when it reaches 50%. • Place the log on a separate physical disk • http://support.citrix.com/article/CTX126916 SQL Maintenance Plans • Database Integrity • Index Maintenance • Update Statistics • Database Backups XDDBDiag (CTX128075) • Overview ○ Command line tool ○ Performs database consistency check on data ○ Collects diagnostic Information Site Information VDA Information Current Connections / Connection Log Hypervisor Connections Policy Information Desktop Groups Controller Information XDDBDiag (CTX128075) • Usage ○ XDDBDiag 2.1 Citrix Support ○ To connect to a local SQL Express database use [local] switch ○ XDDBDiag [local] ○ To pass database connection settings via command line ○ Command line Parameters [windows] [SQL server] [SQL Database] ○ New SQLStats – Database Backup History –SQL Connections –SQL Version Lab #5 General Database Troubleshooting XenDesktop 5.6 Personal vDisk Troubleshooting Pooled Standard Desktop Pooledwith Desktop Personal vDisk A personal vDisk is created for each provisioned virtual machine. During initial session launch that VM is assigned to a single user. User Environment User Data User personalization (settings and installed applications) are stored in the personal vDisk that is merged with the base VM image during session launch. User Settings User Installed Applications Profile Management Citrix Personal vDisk Common Base Image OS Corporate Installed Applications Citrix Personal vDisk Drive Location On base VM as the P: Drive On Hypervisor as <vm_name>_pvdisk 52 Drivers and Components Components Drivers Ivm.sys Ivmvhd.sys CtxPvd.exe CtxPvdSvc.exe Ivmboot.sys Ivmpnp.sys PvDWMI.dll VhdTool.exe These drivers load at system boot time and are responsible for applying the virtualization logic These components handle the initial inventory and image updates as well as VHD management and performance statistics 53 Personal vDisk Process Flow Inventory Process of Base VM Pooled Desktop Start-Up (Initial or Image Update) Personalized Desktop Virtual Logic Application 54 Desktop Director and Personal vDisk • Desktop Director includes helpdesk-facing PvD metrics and support ◦ % of application area in use / total size ◦ % of user profile area in use / total size ◦ PVD reset • PVD reset allows the helpdesk to reset the application area while leaving the user’s data intact: ◦ Similar to “reset to factory default” ◦ Useful when user installed applications are causing problems with the desktop image 55 Log Files PvD maintains logs in the base of the volume attached to the VM • Run ctxpvd.exe –log to create a single PVDLOGS folder created under the %temp% directory Review IvmSupervisor.log … • Located in the root of the P: drive • Windows event logs may also be helpful Lab #6 Personal vDisk Troubleshooting TaaS Preview Session Take Away Critical Tool Matrix for XenDesktop CTX129149 PowerShell SDK CTX127254 See CTX107572 For a Complete List of All Citrix Support Tools XenDesktop 5.x Database Sizing and Mirroring Best Practices CTX127939 How To Move an Existing XenDesktop 5.x Database CTX128365 PvD FAQ CTX131553 Lab Environment Login Launch your browser and type http://training.citrixsynergy.net Your session code is: “session code”