Home > FreeBSD > Two papers On Performance Tuning FreeBSDTwo papers On Performance Tuning FreeBSD Eugenia Loli 2003-12-09 FreeBSD 11 CommentsThese papers were written against FreeBSD 4.x systems but should be equally applicable to 5.x systems on almost all counts: “Compiling and tuning the FreeBSD kernel” and “Performance tuning FreeBSD for different applications“. About The Author Eugenia LoliEx-programmer, ex-editor in chief at OSNews.com, now a visual artist/filmmaker.Follow me on Twitter @EugeniaLoli 11 Comments 2003-12-09 7:08 pm nice 2 articles, i need to get some 15 minutes of my time to give them a good read besides a cross eyebut i notice on the 2nd article theres the mention for-O3: Optimize even more. This option may cause the size of your bianries to increaseand we all know that -03 makes things brake, isnt really a freebsd problem but gcc one 2003-12-09 7:12 pm ok the author mentions on the first that same bit, sry me, and its all over on the first article.But, its never more to say it once more time, keep a tight attention to your make.conf for that issue.Since you cant even compile your kernel at all because of brojk makes 2003-12-09 9:58 pm If you like to make a minimal kernel, you should appreciate this from the NetBSD handbook http://netbsd.org/guide/en/chap-kernel.html#id368364” The adjustkernel Perl script, which can be found at http://www.feyrer.de/Misc/adjustkernel , analizes the output of dmesg and automatically generates a minimal configuration file. To run it you need to have Perl installed on your system. ”I tried this this weekend and it worked like a charm. It reads the dmesg output read what hardware you have and then builds a kernel for the hardware on your box. The down side is (of course) that changing hardware means having to reboot the generic kernel and rerunning the script.There is still room for hand tweaking. (Binaries for 686+, not Pentiums … don’t bother withBSDI binary compatability, etc). But this tool does a nice job of dropping the kernel size with minimum effort. Doesn anyone know about similar tools for the other BSD’s and Linux? 2003-12-10 2:37 am One subtle correction:“At the time of writing, the fastest IDE disks could push 133Mbyte/s, whereas the fastest SCSI disks could push 320Mbyte/s.”Should probably say “At the time of writing, the fastest IDE interface can move 133Mbyte/s, whereas the fastest SCSI interface can move 320Mbyte/s.”The best performance available today from the actual disks connected to these interfaces (stats from storage review):SATA WD Raptor: 72MB/s sequential, 207 IO/sSCSI Fujitsu MAS3735: 78MB/s sequential, 366 IO/sIn terms of value:Raptor: $3.90 per MB/s and $1.40 per IO/sFujitsu:$6.64 per MB/s and $1.41 per IO/sIf you’re server is seek bound, go w/ SCSI and throughput bound go with the Raptor. 2003-12-10 3:04 am both 2 good articles and easy readthe 1st is moved towards 4.x kernels hence the ref to (that should be at top)Counter: 4451 page views since Dec 2002The 2nd is more generic. Some net optimizations enlighted me on some directions and im thankfull to the author for that. I need to get in touch and read more about the subject.about adjustkernel afaik theres nothing, would be already just nice if someone could write a kernel conf file from a running kernel.the best way to get a minimal kernel in freebsd is by trying removing non needed devices/support, dmesg can give a big help here and on a trial&error basis, some minimal line should be achieved> dmesg | sed “s/(.*):.*/1/” | sort -u | morethat will sort out some devices you should make sure they are on your kernel conf, but as i said its a matter of trying 2003-12-10 3:10 am well big deal but, osnes removed backslashes from formhttp://www.pastebin.org/index.php?page=show&id=5184&key=ercem3te4h 2003-12-10 3:55 am ” The adjustkernel Perl script, which can be found at http://www.feyrer.de/Misc/adjustkernel , analizes the output of dmesg and automatically generates a minimal configuration file. To run it you need to have Perl installed on your system. ”i wonder if there is a similar tool for linux??? 2003-12-10 3:50 pm You should *always* use -funroll-loops .. not using it is just stupid. As a matter of fact it should be *standard* unless you’re using -Os or something of the sort.Actually .. you should never even write a finite loop. Write a script to generate the output for it and copy/paste it in your source. Sure you’ll end up with a giant source file but who cares about a few KB when you can download at x megabits per second! 2003-12-10 3:52 pm -O3 works just fine on a lot of things .. just don’t use it for your kernel or I/O drivers or anything! Using -O3 (and full -march optims) for the NVIDIA drivers is sheer suicide.Though for some odd reason I never have problems with aggressive optims on Gentoo (no no, not starting an OS war here you whiny people). Strange. 2003-12-10 6:33 pm You shouldn’t *always* use -funroll-loops, as in some cases it leads to slower executing code. This is true of both toy benchmarks and real programs. The primary reason not to unroll loops is that you’re likely to have more cache misses — which lead to a large performance hit, particularly if you’re dealing with smaller loops. I believe the GCC 3.x series allows for both -funroll-loops and -funroll-all-loops; the latter is almost always a bad choice.Likewise, it’s usually not a good idea to manually unroll loops — doing so leads to a dearth of compiler optimizations and will again usually yield slower code. I also fail to see how unrolling loops will speed up your internet connection. 2003-12-15 9:01 am RAID0 (also called stripping) spreads the data evenly over two or more disks.It’s striping. Sorry to sound like a spelling flame, but this is one of those little things that *really* annoys me. Added to that, if you use incorrect terminology, a) you’ll sound silly to people who know what it really is and b) you might have trouble communicating what you’re talking about.Also, 4 disks in a RAID 0 won’t give you anywhere near a 400% speed increase – and don’t forget while RAID increases throughput, it doesn’t help latency/access time – and will probably make it worse. Another important aspect many people seem to forget is that RAID0 actually *increases* the probability of catastropphic data loss. RAID10 offers the best of both worlds and requires at least 4 disks. Half of the disks are stripped with RAID0, and then both are replicated as a mirror on the remaining disks.You’ve got that back to front. First the disks are mirrored, then the mirrors are striped together. You have described RAID0+1, which is somewhat less fault resistant.Also, there’s no “official” RAID level 10, it is just common terminology for a RAID1+0 setup. RAID is a method of spreading your data over multiple disks. There two reasons why you might use RAID; for redundancy to prevent data loss, and for speed. The three most common types of RAID in use on small system installations are RAID0, RAID1 and RAID1+0 (sometimes referred to as RAID10).Personally I’d say RAID5 is vastly more common in small systems than RAID10 – it’s cheaper and, for most applications, offers acceptable performance. RAID10 tends to be on higher-end installations where performance and ease of managing space takes precendence over GB/$.