Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 64 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
64
Dung lượng
401,9 KB
Nội dung
555 Chapter 19 ✦ Debugging date and time that the processing began, and the time in the seconds that it has been processing the page. The next column, “info,” contains all of the variables in the REQUEST object for that page. There is a lot of useful information in there, such as what page is being requested (PATH_INFO), what page they came from (HTTP_REFERER), any form variables that may have been posted to the page, the username of the requester, and so on. This information is useful for duplicating a request to a page that may be hung or processing too slowly. Figure 19-4: The Zope Debugging Info screen Profiling The Profiling tab in the Control Panel provides some information gathered using the Python profiler. As you can see in Figure 19-5, it details a list of different functions, plus some statistical data on the calling of each function. There are five different columns that provide statistical information. “ncalls” is the number of calls to that particular function. “tottime” is the total time spent executing that function, not including time spent calling other functions. “percall” is “tottime” divided by “ncalls.” “cumtime” is the total time spent executing that function, including time spent calling other functions. “percall” is “cumtime” divided by “ncalls.” What is this data useful for? Primarily, this data is intended to be used to single out the functions in your product that are running slowly and are affecting perfor- mance. Any bottlenecks in your system will show high “tottime” and “percall” and should be revised. i4857-3 Ch19.F 3/1/02 9:43 AM Page 555 556 Part IV ✦ Advanced Zope Concepts Figure 19-5: The Zope Profiling screen Summary As we’ve seen, when it comes to debugging, Zope has a wealth of options available to us. Whether our problems are simple, such as typos or syntax errors, or more complicated, such as locked threads or memory leaks, there is always an option for figuring out where things are going wrong. Simple problems can be debugged using the logging facilities; more complicated problems require the use of the debugger. Because Zope is written in Python many of its debugging options are rooted in Python’s debugging utilities. Python’s maturity gives us well-developed tools that fit nicely within the Zope framework and enable us to examine our work quickly and efficiently. ✦✦✦ i4857-3 Ch19.F 3/1/02 9:43 AM Page 556 Alternative Methods of Running Zope A lthough Zope is quite self-contained and includes every- thing that you need to create and deploy Web applica- tions within a single application, there are times when you want Zope to run a little differently to accommodate your needs. For example, you might want Zope to run behind another Web server, or you may want to deploy Zope as a cluster of servers, rather than a single process. In this chap- ter, we’ll discuss and demonstrate some of those alternatives. Interfacing Zope with Other Web Servers Several of the reasons that you would want to run Zope in conjunction with other Web servers are as follows: ✦ You are already running a Web server and don’t want to put all of your existing pages into Zope just to take advantage of its capabilities. ✦ Many of the files you deliver are large (for example high- resolution graphics or streaming media files), and it doesn’t make sense to serve them up dynamically from Zope when a static file server will work more efficiently. ✦ You have a virtual hosting environment and only want some of the sites served by Zope. ✦ Your boss insists that you use a “standard” Web server. Luckily for you, Zope can easily integrate with other Web servers. 20 20 CHAPTER ✦✦✦✦ In This Chapter Interfacing Zope with other Web servers Zope and scalability ✦✦✦✦ i4857-3 Ch20.F 3/1/02 9:43 AM Page 557 [...]... access the subdirectories This can be done with the following commands: # chown -R nobody Zope # chmod 770 Zope Completing the installation Now change directories into the newly created Zope directory: # cd Zope Then run the wo_pcgi.py script: # python wo_pcgi This installs Zope with only ZServer as the HTTP server If PCGI support is required, then run the w_pcgi.py script instead This begins a rather... chapters 6 through 10 is available in all the intermediate versions in the folders /chapter_06/, /chapter_07/, /chapter_08/, /chapter_09/, and /chapter _10/ Applications The applications described in the following sections are on the CD-ROM Zope Zope is the leading open source application server Ready to install versions of Zope 2.5 for Windows, Linux, and Solaris, as well as the Zope 2.5 source code... Zope from the Red Hat RPMs or Source Code Figure B-3: GnoRPM Add Packages browser Change the directory to your home directory (where you saved the downloaded files), and click the first of the two RPM files you downloaded Then click the Add button This adds the package to the previous dialog box Repeat the last two steps with the second package and click Close You will see, as in Figure B-4, that the. .. you’ve got the source code Now what? You need to do the following five tasks: ✦ Move the tarball into /usr/local ✦ Check the existing Python installation for version and threads ✦ Unpack the Zope source-code tarball and rename the resulting directory ✦ Change to permissions on the directory ✦ Complete and test the install Move the tarball to the /usr/local directory First, as the root user, move the gzipped... install all the software from this CD-ROM Using the CD-ROM with Microsoft Windows To install the items from the CD-ROM to your hard drive, follow these steps: 1 Insert the CD-ROM into your computer’s CD-ROM drive 2 Double-click My Computer 3 Double-click on Zope Bible CD-ROM icon 4 Browse the directory structure Using the CD with Linux To install the items from the CD to your hard drive, follow these steps:... is a quick review of the commands you will be entering: 1 Move the tarball into the /usr/local/ directory with mv Zope- 2.5.0-src.tgz /usr/local/ 2 Unzip and untar the compressed file with with gunzip Zope- 2.5.0-src.tgz and then tar -xvf Zope- 2.5.0-src.tar 3 Rename the resulting directory to something a little easier to type with mv Zope- 2.5.0-src Zope 4 Make sure the files have the proper permissions... many other Linux distributions in addition to Red Hat Linux Downloading the RPMs First, the RPM files must be downloaded to your computer RPM files for Zope are maintained by Jeffrey Rush, and can be found at http://starship.python.net/crew/jrush /Zope/ Follow the link for the most recent version of Zope and select the Group A package, which contains the entire Zope environment in a single package Then... have the development libraries installed for a source installation of Zope to succeed The Python development libraries can be obtained in RPM format from the Python Web site along with the base RPM file j4857-3 AppB.F 3/1/02 9:43 AM Page 577 Appendix B ✦ Installing Zope from the Red Hat RPMs or Source Code Unzipping the archive Now you need to unpack the gzipped tarball into the /zope directory with the. .. chown -R nobody Zope and then chmod 770 Zope 5 Change into the directory with cd Zope 6 Install Zope with python wo_pcgi 7 Run the start script with /start and then point your Web browser at http://localhost:8080/ For further details on setting up and administering your Zope installation, see Chapter 2 Summary In this appendix you learned how to ✦ Install Zope from RPM files ✦ Install Zope from source... command: # tar -xzvf Zope- 2.5.0-src.tgz Now, rename the resulting directory to something a little easier to type with mv Zope- 2.5.0-src Zope Change permissions When Zope is started as root, it switches to the “nobody” user by default, to make sure that the Zope process is not running with excess privileges It’s necessary, therefore, to make certain that the “nobody” user has the appropriate permissions . that the processing began, and the time in the seconds that it has been processing the page. The next column, “info,” contains all of the variables in the REQUEST object for that page. There. processing too slowly. Figure 19-4: The Zope Debugging Info screen Profiling The Profiling tab in the Control Panel provides some information gathered using the Python profiler. As you can see. information in there, such as what page is being requested (PATH_INFO), what page they came from (HTTP_REFERER), any form variables that may have been posted to the page, the username of the requester,