Debug distributed web application (1)

zhaozj2021-02-08  234

Anand Rajagopalan Development Expert E-Commerce Main Support Team Microsoft Corporation 2000 Abstract: In-depth introduction of various tools used to debug distributed web applications. The aim is to debug the intermediate layer Component Object Model (ASP) component in a web-based development environment. table of Contents

Preface Introduction Sets the Common Problem Conclusions of Using Debugging Environment Debugging Procedures

Preface This article will help you understand the use of various tools to debug distributed web applications. In a Web-based development environment, the Intermediate Layer Component Object Model (COM) component is debugged with Microsoft® Internet Information Services (IIS) Active Server Pages (ASP). After reading this article, the user should be able to:

Understand the architecture of IIS. Understand online processed applications, offline processing applications and shared applications, and explain their respective advantages and disadvantages. Learn how to use the Exception Monitor to monitor IIS applications and COM components. Learn how to use User Dump to dump the memory of the process to disk and check it. Learn how to use WindBG to debug a real-time process. Learn how to use performance monitors to solve 100% CPU issues. Learn how to use Console-based debugger (CDB) and Microsoft® Windows NT® Symbolic / Systems Debugger (NTSD). The readers facing the developers, technical support staff, and Web managers who work in website development and maintenance will have a better understanding of the IIS's architecture and debugging.

Introduction The architecture of Internet Information Server is to understand the process of debugging components, and we must first have a good understanding of the architecture of IIS. The following figure will help you understand the relationship between IIS, ASP, Internet Server Application Programming Interface (ISAPI), and components. Figure 1. Architecture of Internet Information Server Internet Services IneetInfo.exe process includes many Internet services (HTTP, FTP, SMTP, NNTP) provided by IIS. InetInfo.exe receives a request from the TCP / IP subsystem and sent these requests to their respective services, which interpret requests, executes requests, and returns the results to the client. Because all of these services are running in the same process (inetinfo.exe), they can share cache data, such as file handles, account information, and log file data. ISAPI Isapi DLL has two types: ISAPI filter and ISAPI extension components. The ISAPI filter is a DLL running in the InetInfo.exe process to filter the data of the entry and export server. Filter registration event notification. When the selected event occurs, the control will be transferred to the filter, you can monitor and change the data sent back and forth between the server and the client. The ISAPI filter can be used to provide enhanced records for HTTP requests (for example, tracking users of logging to your server), custom encryption, custom compression, or other authentication methods. Once the ISAPI filter is implemented, all requests and responses will pass them, which will have a huge impact on the performance of the site. The ISAPI server extension component is a DLL that can be loaded and called by the HTTP server. The ISAPI server extension component, also known as the Internet Server Application (ISA), is used to enhance the functionality of the ISAPI server. ISA is a function similar to the public gateway interface (CGI) application that is called from the browsing response program, but it is better than CGI in performance. Active Server Pages (ASP) ASP is implemented as an extension DLL of ISAPI. IIS and ASP have different thread pools. IIS uses a thread pool called asynchronous thread queue (ATQ), also called shared pool thread. IIS uses ATQ to accept socket connections and send static content to the client. Once the determination request is an ASP page, IIS sends this page request to the ASP / MTS thread pool for processing. All ISAPI management and ASP code are ported to a component called Web Application Manager (WAM). All information passes from the application service layer through the WAM. Asynchronous Thread Queue (ATQ) ATQ provides a reusable thread pool to handle each client request. Use the operating system's completion port logic to perform scheduling. Web Application Administrator (WAM) WAM is a COM component layer above the web service, which stores components of the ISAPI DLL and provides services such as supporting multiple ISAPI DLLs, fault recovery, and process isolation. The WAM is registered as the MTS / COM package / application. Online Processing IIS applications are run if an IIS application is configured to run in an online handling method (low-level application protection in IIS 5.0), then it runs in the web server. This provides a huge performance advantage because avoiding high cost groups across processes. But the disadvantage is that a single failure application may cause the entire web server. This will seriously affect the stability and availability of the web server.

By default, all applications run in IIS 4.0 are running in online processing, while all applications in IIS 5.0 are running with shared offline processing (medium application protection). Offline processing IIS applications prevent single application errors in an offline processing to prevent individual application errors to embrace the entire INetInfo process. Such server protection is very valuable for managing complex product web sites and hosting multiple applications. If an application fails, its process will automatically terminate without affecting the INetInfo process. Another benefit of an application running in an offline processing is that you can uninstall the application without restarting IIS. Applications running in offline processing can get their own ASP WORKER threads. This is a very big advantage, because each of the machines are added to the machine, and the procedure processed application will get another 10 ASP Worker thread. This is just the default, changing the value of ProcessorthReadmax and AspprocessorthReadmax will affect this value. These counters will be discussed in detail later in this chapter. The main disadvantage of the offline process is that each application has its own process space, so there is an overhead that affects performance. Moreover, if a large number of applications are configured in a single server to run in offline processing, it will become fairly resource intensive and will affect the performance of the server. Shared offline processing IIS applications (only in IIS 5.0) IIS 5.0 in the internetrants between offline processing and online processing. All IIS applications configured for shared offline processing are running under a server package / application created under MTS / COM . This option enjoys the advantages of offline processing options because shared applications have their own process space, and an application failure will not affect the availability of a web server. Alternatively, because all shared applications share the same process space, it is not as resource intensive like offline applications. The disadvantage of the application for sharing offline processing is that because the same process space is shared, the failure of an application will cause all applications in the shared pool to fail. In IIS 5.0, the application runs in a shared offline processing by default. Figure 2. Process isolation: Why debugging of performance and rugging is that software developers are used in order to find and resolve issues existing in the code. Even in unit testing and integration testing, it is very striking and correcting the error, but there are still some errors in the product version. Even the products that have passed high quality software survival (with comprehensive unit testing and integration tests) are also unsaptified. Debugging may be the most annoying part of the WEB application developer's work. Unlike independent desktop applications, web applications can be distributed on several systems and often combine different programming languages ​​and technologies. Although some application errors can be avoided by a careful plan, the unpredictable side effects of complex interaction between components will still cause some errors. Tracking and capturing these issues often requires a variety of debugging and development tools. The most important question in debug is that you must keep in debug data instead of debug code. Ask the correct problem to get the right data is very important for successful debugging. The data can be global or partial. The most common mistake in debug is that the symptoms they see are the actual causes of the problem. Before analyzing the debugging process, it is best to be familiar with the term more frequently used in this article.

Attching: attching means monitoring a real-time process to debug it. Checked / debug build: Checked / debug build refers to the component that will be contained in the process. Free build: free build ignores all debugging information to make the process simply and effectively. DUMPING: DUMPING is such a process: When a process occurs, it is written in a file in the memory. The dump is actually an original snapshot of the process address space. Its size is approximately equal to the size of the memory used by the processor. The debugger can be used to analyze dump files to determine what it is doing when the process is documented. Setting the debug environment debug symbol (Symbol Debugging Information) Symbol provides a method of parsing global variables and function names in the loaded executable. The symbol is a function name or API name that is mapped to the offset of the load base address relative to the DLL. The link program generates a symbol during the compilation process of the component. The symbol information is included in the component itself (internal symbol) such that it makes it easy to process, because in this case, there is no matching symbol. The symbols of the components are usually removed in the product so that the size of the component is significantly smaller, and the memory consumed when the component is loaded is reduced, and the components are more efficient. The DBG file is created by separating the symbol from a process image to a separate file using SplitsYM or Rebase. DBG files generally do not include symbols in the form of identifiable code, so it cannot be used for source code level debugging. Microsoft Visual C ® and Microsoft Visual Basic® current versions can create a symbolic format called Program Database (PDB). The debugger can use this PDB file directly. In addition to the symbols of the custom component, the symbol of the Microsoft product is also easy.

Symbol location The following sites Point to these symbols WINDOWS NT 4 Service Pack 6 Symbols http://www.microsoft.com/ntserver/ns/downloads/recommended/sp6/debug/default.asp Windows NT 4 Service Pack 5 Symbols http://www.microsoft.com/ntserver/nts/downloads/recommended/sp5/debug/default.asp Windows NT 4 Service Pack 3 Symbols: ftp://ftp.microsoft.com/bussys/winnt/winnt- Public / Fixes / USA / NT40 / USSP3 / I386 / NT4SYM3I.EXE http://support.microsoft.com/download/support/mslfiles/nt4sym3i.exe Windows Nt Option Pack Symbols: ftp://ftp.microsoft.com/ Bussys / IIS / IIS-PUBLIC / IIS40 / Symbols / X86 / Symbols.cab ftp://ftp.microsoft.com/bussys/iis/iis-public/iis40/symbols/x86/install.inf ftp: // ftp. Microsoft.com/bussys/iis/iis-public/iis40/symbols/x86/install.exe Windows NT Option QFE Update Symbols: ftp://ftp.microsoft.com/bussys/iis/iis-public/fixes/usa/ Iisupd / Symbols / X86 / Iisupdis.exe Site Server 3.0 Service Pack 1 Symbols: ftp://ftp.microsoft.com/bussys/sitesrv/sitesrv-public/fixes/usa/siteServer3/sp1/x86/symbols/ss3sp1db.exe Site Server 3. 0 Service Pack 2 Symbols: ftp://ftp.microsoft.com/bussys/sitesrv/sitesrv-public/fixes/usa/siteserver3/sp2/x86/symbols/ss3sp2debug.exe Microsoft Windows 2000® Server Symbols: http: // Www.microsoft.com/windows2000/downloads/default.asp (English) Windows 2000 Customer Support and Diagnostic Tools CD also included these symbols Common debugging program Overview CDB CDB is a debugger based on the console, It launches and runs in a command window. Because it only accounts for small memory space, it is very efficient. It can be used to debug WIN32 applications on Windows NT. NTSD NTSD is similar to CDB, but it is not running in the window that starts its window, but opens a new window and runs it. Windbg Windbg is a popular lightweight GUI debugger. It can debug WIN32 applications in Windows NT, Windows 95, and Windows 98. It is currently included in the Windows 2000 Customer Diagnostic and Support Tools CD. It can perform source code level debugging, which can read dump files and have excellent support for symbols.

Since it is a GUI debugger, it is slightly slower than CDB and NTSD. IIS Exception Monitor 6.1 IIS Exception Monitor is a lightweight and easy-to-use debugger. Using this debugger can directly separate the DLL that causes problems. It provides a snapshot text file consisting of a process image in memory. It collects information using CDB. Sometimes the information collected may not be sufficient. Run IIS Exception Monitor requires Windows Scripting Host. You can download this tool from the use of IIS Abnormal Monitor (English). The latest version of Exception Monitor 7.x IIS Exception Monitor is part of the DBGPLUS kit that contains all debugging tools discussed in this article. The tool name no longer contains the word "IIS" because it is no longer limited to debug IIS issues; you can use it to debug any process. This tool uses WindBG to collect information about the process it connects to it. Although the function is very similar to its previous versions, the user interface has been completely updated and some new features are added. This tool is included in the Windows 2000 Customer Diagnostic and Support Tools CD, you can also download it from Windows 2000 Customer Support Diagnostics (English). Note: The examples in this article are based on IIS Exception Monitor 6.1. However, it is possible to use the Exception Monitor 7.x slightly modified. Developer Studio Developer Studio is an integrated development environment, including a powerful debugger. It is mainly used in the development phase, and its source code level debugging is excellent and will leave a large memory space. Modifying a lot of system files on the developer studio to your computer; therefore, it is usually not used in the product environment. Developers can write some of their own add-in as needed to customize this debugger.

转载请注明原文地址:https://www.9cbs.com/read-1418.html

New Post(0)