[ Pobierz całość w formacie PDF ]
.CautionTo do this benchmark, you must not store any data in this partition.So, back upeverything you have in /jfs because you will erase everything on /jfs in thisprocess.To benchmark ReiserFS, follow these steps:1.Create a shell script called reiserfs_vs_ext2.bashin the /tmpdirectory.This script is listed in Listing 23-1.Listing 23-1: /tmp/reiserfs_vs_ext2.bash#!/bin/bash## This script is created based on the file_test script# found in the homegrown benchmark found at http://www.namesys.com#if [ $# -lt 6 ]thenecho Usage: file_test dir_name device nfiles size1 size2 log_nameexitfiTESTDIR=$1DEVICE=$2LOGFILE=$6/bin/umount $TESTDIR/sbin/mkreiserfs $DEVICEmount -t reiserfs $DEVICE $TESTDIRecho 1.reiserfs 4KB creating files. m4821-2 ch23.F 2/22/02 10:32 AM Page 655Chapter 23 &' Creating a High-Availability Network655echo  reiserfs 4KB create $3  files of size: from  $4  to $5 > $LOGFILE(time -p./mkfile $TESTDIR $3 $4 $5)>> $LOGFILE 2>&1echo done.syncdf >> $LOGFILE/bin/umount $TESTDIR/sbin/mke2fs $DEVICE -b 4096mount -t ext2 $DEVICE $TESTDIRecho 2.ext2fs 4KB creating files.echo  ext2fs 4KB create $3  files of size: from  $4  to $5 >> $LOGFILE(time -p./mkfile $TESTDIR $3 $4 $5)>> $LOGFILE 2>&1echo done.syncdf >> $LOGFILE/bin/umount $TESTDIR2.Also, download a small C program called mkfile.c, developed by theReiserFS team, to /tmp,from www.namesys.com/filetest/mkfile.c.3.From the /tmpdirectory, compile mkfile.cby using the gcc -o mkfilemkfile.ccommand.4.Change the permission of the reiserfs_vs_ext2.bashand mkfileprogramsby using the chimed 755 reiserfs_vs_ext2.bash mkfilecommand.5.Run the following command from the /tmpdirectory as root:./reiserfs_vs_ext2.bash /jfs /dev/hda7 100000 1024 4096 log6.You will be asked to confirm that you want to lose all data in /dev/hda7.Because you have already emptied this partition for testing, say yes and con-tinue.This test will create 100,000 files in a variety of sizes, ranging from 1K to4K in both ReiserFS (reiserfs) and ext2 file systems by creating each of thesetwo file systems in /dev/hda7in turn.The results will be recorded in the/tmp/logfile.Here is a sample /tmp/logfile:reiserfs 4KB create 100000 files of size: from 1024 to 4096real 338.68user 2.83sys 227.83Filesystem 1k-blocks Used Available Use%Mounted on/dev/hda1 1035660 135600 847452 14% //dev/hda5 4134868 2318896 1605928 60% /usr/dev/hda7 13470048 332940 13137108 3% /jfsext2fs 4KB create 100000 files of size: from 1024 to 4096real 3230.40user 2.87sys 3119.12 m4821-2 ch23.F 2/22/02 10:32 AM Page 656Part VI &' Tuning for Performance and Scalability656Filesystem 1k-blocks Used Available Use%Mounted on/dev/hda1 1035660 135608 847444 14% //dev/hda5 4134868 2318896 1605928 60% /usr/dev/hda7 13259032 401584 12183928 4% /jfsNotice that to create 100K files of size 1K to 4K, ReiserFS (reiserfs) took 338.68real-time seconds; ext2 took 3230.40 real-time seconds.So ReiserFS (reiserfs) sperformance is quite nice.Sharing drive space with NFS serverAlthough you can share static content via a network file system (NFS), earlier I re-commended using local copies of the static files instead.Files stored on a localdrive will yield a much faster access time than any network storage solution unlessyou choose a high-end SAN solution.I highly recommend that you put only files that need to be shared, that changefrequently, or that must use the same data across all Web nodes on a NFS partition.For example, your Web applications can be shared over all nodes so that you havea single copy of all the software.However, more importantly the data that theseapplications create should be shared.For example, if you have a CGI script thatwrites disk-session data for a shopping cart, when the user makes the next requestthe load-balancing scheme that you use might direct the user to a different Webserver on your network, which means that the session data has to be available tothe other Web server or else the user will have to restart her shopping cart.Create a single directory in which you keep all your must-share data.For example,create /www/cgi-dataas your CGI script data directory on the NFS server.You cancreate subdirectories for each CGI application and configure each application towrite to its own directory within /www/cgi-data.Then, mounting this directory viaNFS will make it available to all Web servers in the network.The following sectionsshow you how.Setting up an NFS serverAn NFS server needs to run a program called portmapper (also called portmapor rpc.portmap), which is usually started by an rc script.To check whether port-mapper is already running, use the following command:ps auxw | grep portmapIt turns out that under RedHat Linux, portmapper is automatically started by the/etc/rc.d/rc3.d/S40portmapscript (that is, the /etc/rc.d/init.d/portmap.initscript) so there is no need to manually start it.The next step is to modify the /etc/exportsfile to tell the system what file systemsor directories need to be exported to NFS clients.Because XC News only needs the m4821-2 ch23.F 2/22/02 10:32 AM Page 657Chapter 23 &' Creating a High-Availability Network657/www/cgi-datadirectory exported to the Web servers, the export file on thens.xcnews-lan.comhost looks like this:/www/cgi-data www1.xcnews-lan.com(rw) www2.xcnews-lan.com(rw)This line tells the NFS server to allow both www1.xnews-lan.comandwww2.xcnews-lan.comread and write access to the /www/cgi-datadirectory.NoteThe syntax for the exports file may not be the same for all brands of Unix.The next programs that must run are mountd (rpc.mountd) and nfsd (rpc.nfsd).These two programs are also started automatically from rc scripts in /etc/rc.d/rc3.d.Whenever a change is made to the /etc/exportsfile, however, these twoprograms need to be told about this change.A script called exportfscan restartthese two programs, as follows:exportfsIf exportfsis missing on a system, then a script such as the following can be usedinstead:#!/bin/shkillall -HUP /usr/sbin/rpc.mountdkillall -HUP /usr/sbin/rpc.nfsdecho re-exported file systemsThis script uses the killall program found on most Linux systems; if it is not available,you can always run a pscommand, find the PID for these processes, and manuallyperform a kill -HUPfor each process [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • personata.xlx.pl