Slashdot Mirror


Kernel Comparison: Web Serving On 2.4 And 2.6

An anonymous reader writes "Many improvements have been made in the Linux 2.6 kernel to favor enterprise applications. This article presents results from the IBM Linux Technology Center's Web serving testing efforts, comparing the Linux 2.4 and 2.6 kernels from various aspects. The highlights here are the key enhancements in the 2.6 kernel, the test methodologies, and the results of the tests themselves. Bottom line: the 2.6 kernel is much faster than 2.4 for serving Web pages, with no loss in reliability."

43 comments

  1. Stop pushing. Its all linux by mnmn · · Score: 1

    I see a great push everywhere for everyone to start using 2.6. Why, if youre successfully using 2.4 or 2.2 in your current installation. I remember 2.4 took a LITTLE while to iron out.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
    1. Re:Stop pushing. Its all linux by MBCook · · Score: 5, Interesting
      Did you even read the SUMMARY? On the system they showed, 2.6 performed dramatically better in EVERY AREA. Now if you are running a 128k processor megacomputer with 12 terabytes of RAM and ueberbit ethernet connection, maybe you don't need the performance increase because your computer could serve pages to every other computer ever built without breaking a sweat, but for people with NORMAL comptuers, that isn't the case. Upgrading to 2.6 is basically getting a free performance boost.

      You were having problems with your current webservers? They can't serve pages fast enough? You'll have to spend $50,000 to upgrade so you can handle it? Put 2.6 on! You might be able to hold off that upgrade for 6-12 months, by which time that $50,000 will buy you much more computer than it will today (not to mention you could invest that money and have more by then).

      What do you call a FREE PERFORMANCE UPGRADE? You call it good!

      Besides, it doesn't matter if it needs a "little while to iron out." If you just blindly deploy new kernels on production servers with no testing, you deserve the flack that will come you way if you get bit by a bug.

      --
      Comment forecast: Bits of genius surrounded by a sea of mediocrity.
    2. Re:Stop pushing. Its all linux by Vilim · · Score: 4, Insightful

      At this point 2.6 is _far_ better than 2.4 at the same point in the development cycle. Linus actually ripped out Rik van Riel's VM code and replaced it with new VM code. At this point 2.6 is FAR more stable than 2.4 at a similar stage, there really is no reason for the average user not to upgrade

      --
      History will be kind to me, for I intend to write it - Sir Winston Churchill
    3. Re:Stop pushing. Its all linux by Anonymous Coward · · Score: 0

      Sure there is. 2.4 works fine for me. I have no reason -to- upgrade.

      So fuck you, and fuck everyone else who thinks they have the right to tell me what I want.

    4. Re:Stop pushing. Its all linux by Anonymous Coward · · Score: 0

      Derr yar gad damn raaht Claytis. Garsh darn commie baastrds. Shucks dog gonnit. Yee ha. Uh hyuck.

    5. Re:Stop pushing. Its all linux by Anonymous Coward · · Score: 0

      When someone gives you their opinion, they aren't forcing anything on you. Only if you're truly paranoid do you think that they are forcing you to change and you need to defend yourself against their threat. Let me guess...you also use a 6 year-old computer because it does everything you need it to do. Live in the dark ages if you want; you'll end up wishing you had taken more of the advice you were given in the first place.

  2. Thanks SCO! by Anonymous Coward · · Score: 5, Funny

    See, all that Unix code that IBM stole from SCO and inserted into the Linux kernel was worth it!

  3. Re:The question is.. by pilot1 · · Score: 3, Funny

    This is not a troll, but a serious answer.
    None.

  4. Why upgrade? by flikx · · Score: 3, Funny

    Aside from a small performance boost, is there really any reason to update perfectly stable systems? My shop has been using a few boxen running RedHat 5.2 for almost seven years now. If everything is stable, why upgrade?

    --
    One future, two choices. Oppose them or let them destroy us.
    1. Re:Why upgrade? by WasterDave · · Score: 5, Informative

      In the case of RH5.2, security. I hope you've been doing the furious quantity of patching necessary to keep that secure. If not, I'd seriously consider moving to Debian. You still have to secure it, but it's really easy to do.

      The small performance boost, according to this paper, is large. Huge, much the same as the scalability boosts that came in as a result of the mindcraft benchmarks. However, they are for the most part improvements in SMP. There are also some "responsiveness" improvements in the scheduler.

      Should you move to 2.6? Probably not. As far as I can tell the gains are on big iron, really really small iron, and the desktop. I'm sure as hell not moving off 2.4 any time soon.

      Dave

      --
      I write a blog now, you should be afraid.
    2. Re:Why upgrade? by scishop · · Score: 4, Funny

      A "small performance boost"? IT'S FIVE TIMES FASTER! Any smaller and it would be in hyperspace.

    3. Re:Why upgrade? by Sepper · · Score: 2, Informative

      Aside from a small performance boost

      Small...right... i'll refer you to the text of the article:

      Conclusion
      We've shown that, using a typical test scenario -- Apache/WPT on an 8-way SMP IBM xSeries system -- the Apache server has better scalability and performance on the 2.6 kernel compared to the 2.4 kernel. On the same system under the same workload, the Apache server with 2.6.0-test5 kernel more effectively used system resources and served 5 times more Web pages than the 2.4.18 kernel did. This real data demonstrates that a variety of features and changes have helped the 2.6 kernel offer better scalability and performance and become more mature for enterprise-level applications.


      --
      I live in Soviet Canuckistan you insensitive clod!
    4. Re:Why upgrade? by p00ya · · Score: 1
      As far as I can tell the gains are on big iron, really really small iron, and the desktop.

      "Little Tin" perhaps?
  5. Enterprise applications? by Fritz_the_Cat · · Score: 2, Insightful

    I don't know about you guys, but I'm not too sure that I would describe this article as an examination of an "Enterprise application" on Linux.
    Enterprise applications are many things to many people, but rarely are they web servers.
    Enterprise servers are generally run complex applications running many complex operations.
    While I'm sure IBM's web server is very good, I don't think that it would be typical of an "Enterprise application".

    My point is, while I'm sure this is a fantastic article examining performance improvements between Linux kernel versions, let's not pretend it's something that it isn't.

  6. A marvelous understatement by leifw · · Score: 5, Funny
    From the article:
    "O(1) scales well..."

    No, really?

  7. Consumes more RAM... by gregfortune · · Score: 2, Informative

    While the performance gains are impressive (about 5 times as many pages under 2.6) it also shows that 2.6 used 5.6 times more RAM to serve the increased number of pages. If RAM on the system isn't limited, the performance gain is insane. If the system is already overloaded w/respect to RAM, it likely won't help much and there's a *slight* chance it would actually perform worse.

    Of course, this is just a benchmark ;o)

    1. Re:Consumes more RAM... by Anonymous Coward · · Score: 5, Interesting

      Isn't that just a function of having 5 times as many apache processes serving content?

    2. Re:Consumes more RAM... by Anonymous Coward · · Score: 0

      I switched back to the 2.4 series recently for performance reasons. Of course, my computer has much less than 9 GB of ram... maybe this had something to do with the lost performance?

    3. Re:Consumes more RAM... by Anonymous Coward · · Score: 0

      Post this to the kernel mailing list if you're serious. What sort of system (esp. RAM size), where are you seeing performance loss, how does 2.4 fare in comparison?

  8. Headline: Linux Makes Bad Code Look Better by LunaticLeo · · Score: 5, Informative

    The new linux kernel is great, but the reason the this particlular kernel results is better performance ("5 times better") is because the application framework it is testing is horrible.

    All of the "enterprise" applications in this test have several performance cripling features in common: socket per thread connections, fundemental reliance on threads, and massive memory foot print. Apache has one thread/process (the diff is a stack) per connections. Java requires a sizable multiple of memory usage as most other application languages (C/C++ obviously, but also Perl, Python, and PHP). J2EE is an inherently thread driven programming framwork.

    So yes, Linux 2.6 ameliorates the downsides of unnecessary use of threading. It makes thread creation and context switching even faster on the Linux platform.

    And Yes, Linux 2.6 memory management is fundementally better. Reverse Page Table Entry mappings make finding victim pages better; and it is designed to avoid victimizing active pages better.

    But could you all imagine if people were designing fundementally better application framworks? Event driven application architectures like TwistedPython and POE, or Event-thread hybrid systems like SEDA.

    The performance stats given in that article are shit, complete utter shit. I know. In the proprietary world I work in, I code faster programs on the same Linux platform on a daily basis; orders of magnitude faster.

    All the accomplishments of Linux 2.6 can be used for true performance programming. I plead with you all, stop using Threads until you know what they are good for. Stop using the stack to maintain your program state. Throw off the shackles and learn to program network servers.

    --
    -- I am not a fanatic, I am a true believer.
    1. Re:Headline: Linux Makes Bad Code Look Better by Anonymous Coward · · Score: 0

      My god. With you there to direct everyone I wonder why there is any multi threaded code left anywhere.

      Oh, and what has your two memory management lines got to do with anything? Were they just there to make you sound smart? Tell me, how do reverse page tables 1. make finding victim pages better, and 2. avoid victimizing active pages better?

    2. Re:Headline: Linux Makes Bad Code Look Better by gunga · · Score: 1

      Thank you for your links. Most informative slashdot post in ages!

    3. Re:Headline: Linux Makes Bad Code Look Better by Anonymous Coward · · Score: 0

      Yeah, "enterprise software" was largely designed for OSes like Solaris or NT where Threads weren't third class citizens like on earlier versions of Linux.

      While that whole "Threads are for people who can't understand State Machines" bullshit might be fun for the kids, Linux was designed to run other people's software from day 1.

    4. Re:Headline: Linux Makes Bad Code Look Better by arkanes · · Score: 0, Troll
      Thats not informative, thats just dumb. How do you think things like I/O completion are implemented? Crappy threading performance on Linux (and in unix in general) has historically been because of crappy threading libraries, and because process creation is relatively cheap so people tended to just fork children instead of spinning threads. Just because you're doing it in kernel threads instead of userspace threads doesn't mean that it's not threaded.

      And I'm _really_ not sure why you're showing us a frigging Python framework as some sort of example of super-performant network programming. Pythons great and all but a performance monster it is not. "Yeah, boss, we use a runtime-compiled interperter for all our performance-critical code, but by God we avoid context switching!"

    5. Re:Headline: Linux Makes Bad Code Look Better by Hard_Code · · Score: 2, Informative

      Whatchoo talkin' 'bout Willis!? There are two fundamental approaches to high load: threaded blocking IO, or non-threaded async IO. Both are different abstractions for the same fundamental goal of adding concurrance to a system. In reality most sites will do just FINE by modelling concurrency with a threadpool and blocking IO. Sure you CAN use non-threaded (or "less-threaded") async IO, but you incur a complexity overhead (this is the "overhead" hidden by the simplicity of threads). Unless you are writing an eBay or Amazon.com or Yahoo.com, a threaded/blocking-IO approach will work fine. Since it IS such a popular model, I think it is definately legitimate to compare kernel performance on those grounds. Note that I keep saying "abstraction" and "model". In reality there is nothing mandating that the thing I call a "thread" must really be implemented by a 1:1 mapping to a kernel lieghtweight process. Many systems use "green" threads or some other sort of user-space threading, so the implementation distinction is not as important.

      To be completely optimal you wouldn't want a pure implementation of EITHER model, but some sort of hybrid in which you have a some number of threads, which each do some async IO. It all depends on the CPU/IO ratio for your app.

      Maintainability is consistently underrated. You should shoot for a performance goal, and then create the SIMPLEST POSSIBLE SOLUTION to meet that goal...not spend days, weeks, months in coding kung foo zen. By the time you get out of your optimization stupor, hardware and network advances will probably have rendered your solution unnecessary.

      --

      It's 10 PM. Do you know if you're un-American?
    6. Re:Headline: Linux Makes Bad Code Look Better by LunaticLeo · · Score: 2, Informative

      what has your two memory management lines got to do with anything?

      When the kernel needs to get free memory pages, it looks on some sort of free page list or it has to find a victim page. There are lots of strategies to find victim pages. The reverse page table mappings allow the kernel to scan only pages in memory for victims and not have scan the virtual mappings for pages in memory AND satisfy some "victimizable" criteria.

      Secondly, reverse page mappings alow you to know more about the page, like it is shared by several processes. The quick access to additional information allows you to make better choices about which page to swap out

      I don't pretend to know everything about virtual memory systems. However, I do read LKML and these are the arguments others have made which to some degree I am parroting here (but I do get the gist of it).

      --
      -- I am not a fanatic, I am a true believer.
    7. Re:Headline: Linux Makes Bad Code Look Better by LunaticLeo · · Score: 1

      Thanks for your reply. Here is my best response.

      Try to remember I was replying to a article about how fast a web-based enterprise application is affected by the new linux kernel. That means many network connections to both clients, middleware, and even databases, with high transaction rates. I am not talking about an FTP server downloading big static files to a few users.

      Unless you are writing an eBay or Amazon.com or Yahoo.com, a threaded/blocking-IO approach will work fine.

      /me smiles

      To be completely optimal you wouldn't want a pure implementation of EITHER model, but some sort of hybrid

      Did you check out SEDA. That is an event-thread hybrid model. Unfortunately, it is not as alergic to context switches as I think it should be.

      The big win is that explicitly maintaining state for connections allows you to avoid context switches. The threading part of a hybrid model is for two things: one taking advatage of multiple cpus and two allowing for the use of blocking APIs when it can't be avoided. Hence, you learn a new rule: threads should scale with the number of CPUs, not with the number of data structures you are working on (aka the implicit "connection state structure").

      There was a time when GUI framework designers thought every widget in an application would have it's own thread. Notice how that hasn't occured? ever wondered why? GUIs are event driven programs with the sprinkling of threads where they make sence; sorta like what I am talking about.

      Maintainability is consistently underrated.

      I couldn't aggree more, but ... always a but ... event driven network programming requires a natural break down of your app to discreet events, aka request-do_work-response. This is how network servers nessesarily operate. Hence, programming in an event driven paradigm (eek I said it) is eminently maintainable and clear. Further, the point of using a framework is to let the framwork writter do all the dirty work and you just express the higher level operations, hence clarity and maintainabilty.

      Lastly, there is a distinction between Design which leads to performance and Optimizations. I am suggesting that in what ever reasonably upto date language you choose, be it Perl, Python, Java, C++ or C, the design of your program determins the scalabilty of your program. Optimizations take alot of work, and don't affect the scalability of your program by orders of magnitude. If an "optimization" does affect your program by that much you are probably removing brain damage, rather than genuinely tweaking your code.

      --
      -- I am not a fanatic, I am a true believer.
    8. Re:Headline: Linux Makes Bad Code Look Better by LunaticLeo · · Score: 2, Insightful

      Thats not informative, thats just dumb.

      I think I'll disagree with you on that.

      How do you think things like I/O completion are implemented?

      I've heard that the have a thread waiting for each completion port, sorta like the aio_* implmentation on Irix. But, you might be thinking I am some Microsoft stuge, just so you know I don't do windows; sometimes FreeBSD (cuz it has some cool stuff), but nearly exclusively Linux for the last 10 years.

      Crappy threading performance on Linux (and in unix in general) has historically been because of crappy threading libraries, and because process creation is relatively cheap so people tended to just fork children instead of spinning threads.

      I think I have used those very words myself.

      Just because you're doing it in kernel threads instead of userspace threads doesn't mean that it's not threaded.

      I never suggested user space threads. They don't require kernel intervention, but they don't utilize multiple CPUs. And M:N threading libraries are out of fashion. Apparently all those smart people realized that two levels of schedulers were hard to make fair and fast at the same time. NGPT lost in favor of 1:1 in NPTL (LinuxThreads just blew chunks). Solaris9 now makes 1:1 threading library default, where Sun used to trumpet the glories of their then new, now old, M:N thread library (now if they would just shoot mtmalloc in the head and be done with it).

      And I'm _really_ not sure why you're showing us a frigging Python framework as some sort of example of super-performant network programming. Pythons great and all but a performance monster it is not. "Yeah, boss, we use a runtime-compiled interperter for all our performance-critical code, but by God we avoid context switching!"

      As I said in another post in this thread: scalability comes from design not from optimization. If Perl or Python or Java are a constant factor slower, but I use a better algorithm, I can beat C/C++ hands down. I saw someones sig that said something like "If it can scale, I can buy performance." So while scalability != performance there is a relationship. And with a bunch of cheap PCs running Linux, I can crush someone elses Apache/JBoss/Websphere "enterprise" app running on some Sun E15K monstrosity.

      --
      -- I am not a fanatic, I am a true believer.
    9. Re:Headline: Linux Makes Bad Code Look Better by arkanes · · Score: 1
      This is a much better post than your original one :P For one thing, you avoid the generic "threading is bad" argument.

      The main reason why people (at least on Linux & other unixy platforms) have avoided threading in really high end/scalable servers is because threads don't scale well. Well, now we've got a scheduler and thread libraries that scale very nearly 1:1. You're talking about designs that work around a problem that no longer exists (well, at least isn't as extreme - I haven't done the sort of testing and benchmarking I'd need to do to say that with real confidence). Theoretically, a threaded implementation will outperorm a non-threaded one - when one thread is blocking on i/o, another one can step in and do some work. The reality of that is less perfect, of course, but we're getting alot closer. Event driven design is great(I'm a big fan of this myself). I/O completion ports are great, but they're just the kernel cooperating to make your threads more efficent. Most of the architectures you point to as an alternative to threading are implemented using threads under the hood - given good thread libraries (which Linux has, now) there's no reason you can't just use threads directly and save the overhead of the framework (there may be other reasons to use the framework, but if your main concern is top-end scalability and I/O you won't want to do that).

    10. Re:Headline: Linux Makes Bad Code Look Better by ninejaguar · · Score: 1
      I followed your link...

      "Throw off the shackles and learn to program network servers."

      ...and found this under the "Lock Contention" heading:

      "Dividing code into stages is a complicated matter of program design, so there's not much I can offer there"

      The inevitable disclaimer buried in the majority of all literature attempting to discuss concurrency. Try this for a practical remedy.

      = 9J =

    11. Re:Headline: Linux Makes Bad Code Look Better by johnjosephbachir · · Score: 1

      i'm not sure if i'm being too picky or not picky enough with my terminology, but great event driven servers can still (and should) use threads, they just just shouldn't be spawned dynamically per request/task. so... event driven != no threads.

  9. SMP and scheduling by Anonymous Coward · · Score: 0

    i was just wondering if there would be
    any improvement to scheduling on
    two processor system if it
    wasn't SMP (symmetric multi processor)
    but asymmetric.

    one processor doing the scheduling (over kill?)
    for the second processor ...

    if you had 8 processor two processors would do
    the scheduling. this is interessting 'cause
    as far as i can tell the scheduling idea
    of linux is kindda using two "processes"
    to implement the schedular. with eight
    processors and two processors doing the
    scheduling maybe get a dimension higher (4)?

    i never had a multiprocessor system or even
    hyperthreading, but it sounds interessting
    considering the possibilty running a "real"
    OS on one processor and having it run
    a virtual box (or a second layer on the second
    processor "slut processor") :P

    2 cents

    1. Re:SMP and scheduling by Anonymous Coward · · Score: 0

      No, using one processor to "schedule" for another isn't a good idea.

      First of all, scheduling just doesn't take up much time. In the new 2.6 scheduler, its little more
      than taking an item off the end of a queue. The actual context switch takes far more time, but you
      don't get out of that by someone else handing you the process to run. Doing real work for the
      process also takes far more time, so your "slut processor" will be idle 99% of the time.

      Which brings me to my second point - keeping per CPU data private. Avoiding sharing data between
      CPUs is one of the biggest efficiency issues in an SMP system (the other being parallelisation). The
      reason why the scheduler is so scalable is because it maintains a per CPU runqueue, and the
      scheduling operation is basically lockless. You only have to take another CPU's lock or touch its
      data when doing load balancing.

      A third problem is inter processor signaling. How do you ask the "slut processor" to schedule you
      another task? You need to send an IPI, and fall idle until it recieves the IPI, selects a task for
      you, and send you back another IPI. IPIs are often pretty expensive too. Alternatively you could do
      busy waiting with locks, but thats horribly inefficient too.

      So no, this isn't a good idea.

  10. Re:The question is.. by Anonymous Coward · · Score: 0

    Quite a bit comes from IBM's RCU, which may or may not be SCO code, depending on what the Judge thinks of the contract Sequent signed with SCO.

  11. hyperthreading aware scheduler is not in yet by pixelbeat · · Score: 1

    Don't think so anyway. According to the author
    Ingo Molnar:

    On Thu, 18 Dec 2003, Ingo Molnar wrote:
    > Jeff Garzik wrote:
    >
    >>Are you sure? I could have sworn Ingo made the scheduler magically
    >>HT-friendly...
    >
    > nope, it's not in 2.6 yet. This area is still under development,
    > with various approaches being considered.
    >
    > Ingo

    1. Re:hyperthreading aware scheduler is not in yet by grahamdrew · · Score: 1

      It hasn't been integrated into mainstrem yet, but it is integrated into Andrew Morton's patchset.

      --
      // Dumps core here
  12. MPM Module(s) Used with Apache? by Lexicon · · Score: 2, Interesting

    I would be interested in knowing which MPM module(s) they used with Apache in their testing. Whether they used worker, prefork, or something else could make a big difference in serving performance. It would also test different areas of kernel performance I would think.

  13. TwistedPython has a severe limitation by jgardn · · Score: 2, Informative

    TwistedPython runs everything from a single thread. Even if you have multiple threads, only one thread can be running at a time due to Python's GIL (Global Interpreter Lock).

    Diregard the fact that TwistedPython is still in its infancy and thus immature compared to its rivals.

    The fundamental problem with it is that it will not scale well to multiple processors because all of the python threads must interact and share the same memory. It's not like Apache which has one master process that handles incoming connections, and several children distributed across the processors, using seperate sections of memory - it is only a single process with multiple Python threads, forced to run one after another thanks to the GIL.

    Apache scales far better than TwistedPython. When you have a properly scaleable database backend, or some kind of application logic layer that can scale, then it behaves very well as the load increases and on more advanced hardware.

    Understand that I'm not saying that "TwistedPython Sux!" I am saying that I won't be using it for an application server that must scale. Once Python overcomes the GIL problem (and offers shared memory for Python objects) then TwistedPython may begin to have some hope of actually scaling.

    --
    The radical sect of Islam would either see you dead or "reverted" to Islam.
  14. No. Optimize later. by Anonymous Coward · · Score: 0

    Stop using the stack to maintain your program state.

    Sorry, I can't get behind that approach.

    The most important thing for a server app, up 24/7, is that it is CORRECT. Programmed correctly, proven correct. The easier this is, the faster we can ship and upgrade with confidence. Breaking your application down, you may find that certain problems are best solved with one programming technique or another. Perhaps one search is best modelled with recursion. So do it that way. If you did it without recursion, maybe you could wring a bit more performance out of it, but let's just make it work CLEARY, CORRECTLY first. Optimize later. Anyone from a CS, especially functional, background will naturally see certain (not all, I hope!) problems as falling out of recursion. Recursion requires using the stack to maintain program state. And it's the right thing to do in many cases. Optimize later.

  15. Event driven application frameworks are kludges by Per+Abrahamsen · · Score: 2, Insightful

    ...around poorly designed operating systems where threads are slow. The cool thing about 2.6 is that there now is one less motivation for using such kludges.