Zum Inhalt springen
BlogLinodeLinode.com Status Update 06.04.04

Linode.com Status Update 06.04.04

[b]Linux 2.6 auf den Hosts[/b][/size]

Sechs von 20 Host-Servern laufen jetzt auf der Version 2.6 des Linux-Kernels mit dem CFQ Fair-Queuing Disk-Scheduler.

Jetzt, wo wir es eine Weile auf einigen Rechnern laufen lassen, habe ich ein ziemlich gutes Gefühl dafür, wie es sich verhält. Ich habe festgestellt, dass 2.6 bei einigen Workloads besser und bei anderen Workloads etwas schlechter abschneidet als 2.4 (festgestellt durch den Vergleich von mrtg- und vmstats-Ausgaben vor und nach 2.6). Ich bin optimistisch, dass mit einigen der VM-Tuning-Optionen (/proc/sys/vm/*) weitere Verbesserungen erzielt werden können.

Insgesamt denke ich, dass 2.6 "eine gute Sache" ist, und wir werden den Rest der Hosts irgendwann auf 2.6 umstellen.

[b]Disk I/O Thrashing gibt es nicht mehr![/b][/size]

Der Hauptgrund, warum ich auf 2.6 umsteigen wollte, waren die Verbesserungen der E/A-Leistung gegenüber 2.4.

Linux ist anfällig für das, was ich eine "Festplatten-Denial-of-Service-Attacke" nennen würde, wenn es eine hohe Rate an zufälligen Lese-/Schreibanforderungen gibt, die die Anforderungswarteschlange(n) füllen. Dies führt zu Latenzproblemen bei anderen Anfragen und bringt die Dinge im Wesentlichen zum Kriechen.

Dies ist genau die Art von Arbeitslast, die auftritt, wenn eine Linode ständig ihre Swap-Geräte auslastet (schnelles Lesen und Schreiben) und wenn der Host unter Druck steht, diese schmutzigen Seiten herauszuschreiben (was er immer tun wird, nach einiger Zeit). Leider hat der CFQ-Patch auf 2.6 dieses Problem nicht gelöst. (Genauso wenig wie die standardmäßigen vorausschauenden oder Deadline-Scheduler).

CFQ hilft ein wenig bei vielen Threads, die zufällige E/A durchführen (wie bei den Cron-Job-Partys), aber es beseitigt nicht die Möglichkeit, dass eine Linode den gesamten Host verkeilt. Lesen Sie weiter für die Lösung...

[b]UML I/O Request Token-Limiter patch[/b][/size]

Ich habe einen einfachen Token Bucket Filter/Limiter um den asynchronen UBD-Treiber in UML implementiert. Die Token-Bucket-Methode ist ziemlich ordentlich. Es funktioniert folgendermaßen: Jede Sekunde werden x Token zum Bucket hinzugefügt. Jede E/A-Anforderung erfordert ein Token, also muss gewartet werden, bis der Bucket einige Token hat, bevor die E/A durchgeführt werden darf.

Diese Methode ermöglicht eine berstbare/unbeschränkte Rate, bis der Eimer leer ist, und dann beginnt er zu drosseln. Perfekt!

Links:
[url=http://www.theshore.net/~caker/patches/token-limiter-v1.patch]token-limiter-v1.patch[/url]
[url=http://www.theshore.net/~caker/patches/token-limiter-v1.README]token-limiter-v1.README[/url]

[b][color=darkred]Mit diesem Patch kann eine einzelne Linode den Host nicht mehr verkeilen![/color][/b]

Dies ist eine große Sache, da die einzige Methode, dies zu korrigieren, wenn es passiert, war für mich zu intervenieren, und stoppen Sie die beleidigende Linode.

Der Limiter-Patch ist im Kernel 2.4.25-linode24-1um (2.6 folgt in Kürze).

Die Standardwerte sind sehr hoch eingestellt, und ich bezweifle, dass jemand von Ihnen bei normalem Gebrauch davon betroffen sein wird. Ich kann die Werte für Nachfüllen und Eimergröße während der Laufzeit ändern, so dass ich in der Lage sein werde, einen Monitor für jeden Host zu entwerfen, der die Profile je nach Host-Auslastung dynamisch ändert. Das ist eine große Sache 🙂 .

[b]Linux 2.6 für die Linodes[/b][/size]

Ich habe den Kernel 2.6-um noch nicht offiziell angekündigt. Es gibt noch ein paar Bugs und Leistungsprobleme, die ausgearbeitet werden müssen. Ich empfehle noch nicht, den 2.6-um-Kernel für den produktiven Einsatz zu verwenden, aber ein paar abenteuerlustige Benutzer haben ihn getestet und über einige der Macken berichtet, die damit verbunden sind, ihn unter jeder Distribution zum Laufen zu bringen. Ich werde versuchen, eine Anleitung für den Umstieg auf 2.6 zu erstellen und sie zu veröffentlichen, sobald der Kernel stabiler ist.

[b]Was gibt es Neues in der Welt der UML?[/b][/size]

Wir sind schon lange überfällig für neue UML-Patches. Ich schätze, dass wir innerhalb der nächsten zwei Wochen eine neue UML-Version (sowohl für 2.4 als auch für 2.6) haben werden.

Neben den üblichen Fehlerbehebungen weiß ich, dass Jeff an der AIO-Unterstützung für den IO-Treiber in UML gearbeitet hat. AIO ist eine neue Funktion, die in 2.6 (auf den Hosts) implementiert wurde. Einige Vorteile sind:
[list][*] Die Möglichkeit, mehrere I/O-Anfragen mit einem einzigen Systemaufruf zu senden.
Die Möglichkeit, eine E/A-Anforderung zu übermitteln, ohne auf ihre Fertigstellung zu warten, und die Anforderung mit anderer Verarbeitung zu überlappen.
Optimierung der Festplattenaktivität durch den Kernel durch Kombinieren oder Umordnen der einzelnen Anforderungen einer gestapelten E/A.
[*] Bessere CPU-Auslastung und Systemdurchsatz durch Eliminierung zusätzlicher Threads und Reduzierung von Kontextwechseln.
[/list]
Mehr zu AIO:
http://lse.sourceforge.net/io/aio.html
http://archive.linuxsymposium.org/ols2003/Proceedings/All-Reprints/Reprint-Pulavarty-OLS2003.pdf
- —

Das ist alles!
-Chris


Kommentare (12)

  1. Author Photo

    This may be naive, but wouldn’t it help tremendously to have all the swap partitions for a given linode on a different drive?

  2. Author Photo

    [quote:9a75d3e3be=”diN0″]This may be naive, but wouldn’t it help tremendously to have all the swap partitions for a given linode on a different drive?[/quote]
    It might, but that’s not the point, really. Before this patch, a single UML could consume all of the I/O (say, for a given device, like you suggested). It would still cause the same problem when other Linodes tried to access the device. The same effect can be had with “swap files” that exist on your filesystem (rather than actual ubd images) or heavy I/O on any filesystem.

    With this patch, I am able to guarantee a minimum level of service. Previously that wasn’t possible.

    -Chris

  3. Author Photo

    Great work chris, I genuinely can’t think of anything else you can improve upon! 😉

  4. Author Photo

    Chris,

    I tried the 2.6 kernel of Redhat 9 (large) a few days ago. It failed to boot & I had to switch back to 2.4.

    Another forum thread had the same problem.
    dev/ubd/disc0: unknown partition table
    /dev/ubd/disc1: unknown partition table

  5. Author Photo

    I am really excited about this. As you know I have been one of the most vocal proponents of some system of throttling disk I/O so that an overzealous Linode cannot DOS the host.

    It sounds like this solution will require everyone to upgrade to a 2.6 kernel, which means that it cannot be applied until everyone is ready to go to 2.6 (and it will only be effective when *everyone* has upgraded to this fixed kernel). So I guess the solution is months away. But at least there is a plan in the works to solve this problem for good.

    Great job man! Keep up the good work!

  6. Author Photo

    Just curious – why not solve this problem in the host kernel instead? Can the host kernel be patched to limit any one of its processes using the I/O token system that you have devised? Then the Linode themselves can run any kernel they want to and the host system will prevent any one from thrashing the disk.

    Ideally this would be some kind of rlimit option, so that it could be applied just to the Linode processes themselves and not to the other processes of the host system.

    I don’t know if the I/O layer that’s deeper in the kernel than the UML ubd driver is harder to work with though … perhaps it would be too complex to modify the fundamental Linux I/O code than it is to modify the ubd driver?

  7. Author Photo

    caker, thanks for all the hard work you’ve put in to keep the linode hosts in top shape.

    It’s rather surprising that CFQ didn’t solve the I/O scheduling problem, though. The algorithm is supposed to be [i]completely fair[/i] towards each thread requesting I/O. 😛

  8. Author Photo

    [quote:52760ef410=”Quik”]Great work chris, I genuinely can’t think of anything else you can improve upon! :wink:[/quote]
    Thanks Quik 🙂

    [quote:52760ef410=”gmt”]Chris,

    I tried the 2.6 kernel of Redhat 9 (large) a few days ago. It failed to boot & I had to switch back to 2.4.

    Another forum thread had the same problem.
    dev/ubd/disc0: unknown partition table
    /dev/ubd/disc1: unknown partition table[/quote]
    You can always ignore this warning message — it’s just telling you that the ubd devices are not partitioned. You’re using the entire block device as one giant ‘partition’.

    To get 2.6 to work under RedHat, first rename /lib/tls to something else (since 2.6-um and NPTL don’t mix yet).

    -Chris

  9. Author Photo

    [quote:2eaacf3890=”bji”]I am really excited about this. As you know I have been one of the most vocal proponents of some system of throttling disk I/O so that an overzealous Linode cannot DOS the host.

    It sounds like this solution will require everyone to upgrade to a 2.6 kernel, which means that it cannot be applied until everyone is ready to go to 2.6[/quote]
    Not sure where you read that from my post. I’ve already patched the 2.4.25-linode24-1um kernel with the token-limiter patch, and 2.6-um to follow shortly.

    [quote:2eaacf3890=”bji”](and it will only be effective when *everyone* has upgraded to this fixed kernel). So I guess the solution is months away. But at least there is a plan in the works to solve this problem for good.[/quote]
    Most/all of the repeat offenders have already been rebooted into the “linode24″ kernel (with the limiter patch). So the solution is in effect right now. But, you are correct — there are still many Linodes running un-limited.

    [quote:2eaacf3890=”bji”]Great job man! Keep up the good work![/quote]
    Thanks!

    -Chris

  10. Author Photo

    [quote:f066e66db0=”bji”]Just curious – why not solve this problem in the host kernel instead? Can the host kernel be patched to limit any one of its processes using the I/O token system that you have devised? Then the Linode themselves can run any kernel they want to and the host system will prevent any one from thrashing the disk.

    Ideally this would be some kind of rlimit option, so that it could be applied just to the Linode processes themselves and not to the other processes of the host system.

    I don’t know if the I/O layer that’s deeper in the kernel than the UML ubd driver is harder to work with though … perhaps it would be too complex to modify the fundamental Linux I/O code than it is to modify the ubd driver?[/quote]
    I agree — the correct solution is to get Linux fixed, or perhaps to get UML to use the host more efficiently. Some of the UML I/O rework is already under way (the AIO stuff), but that kind of thing *is* months away…

    One interesting “feature” of the CFQ scheduler is an ionice priority level. But, I wasn’t able to get the syscalls working to test it.

    -Chris

  11. Author Photo

    [quote:01c9cda963=”griffinn”]caker, thanks for all the hard work you’ve put in to keep the linode hosts in top shape.

    It’s rather surprising that CFQ didn’t solve the I/O scheduling problem, though. The algorithm is supposed to be [i]completely fair[/i] towards each thread requesting I/O. :P[/quote]
    I’m not sure where the bottleneck is — but as far as I can tell, CFQ and the standard scheduler in 2.4 appear equally (non)responsive in the worst-case scenario. Go figure…

    One interesting thing is that UML uses the no-op elevator. Jeff and I got into a discussion about this, and he says there’s no point to UML doing any request merging, but I disagree. I’d rather have UML do some of it’s own request merging and reordering than force the host to do it all. Plus, it makes UML appear to the host as more of a streaming type load than a random load…

    Think back to the last set of tiobench benchmark results you’ve seen — look how poorly the random-i/o results are compared to “streaming-read” and “streaming-write”…

    So .. another hack to the UML code (one-liner) to test…

    -Chris

  12. Author Photo

    Thanks, Caker. I have a tiny linode and I make almost no demands on the system, so far at least. However, fairness is part of what you sell. It sounds like the leaky bucket in the UM kernel solves most of the problem with a minimum of effort. I’ve been implementing fairness algorithms for at least 30 years, so I have a few theoretical observations and questions:

    You appear to be issueing tokens independently to each process at an absolute rate, independent of the actual resource availability. This means that a UML may get limited even if nobody else wants the resource, yes? It might be better for the host kernel to issue tokens at an over-all rate to the UMLs.That way a particular UML can use the whole resource if nobody else wants it. since everybody’s buckets are full, the instant anyone else wants to use the resource the original user is instantly throttled to 50% as the tokens are returned equally to the two users, and so on as more users are added. That is, the main kernel returns tokens to each UML with a non-full bucket equally, but does not add tokens to a bucket that is already full. The host kernel should dyamically adjust its token generation rate to just keep the resource occupied. I’ve successfully done this in the past by watching the resource: if the resource goes idle when thre are any empty buckets, slightly increase the token rate. If the resource never goes idle, slightly decrease the token rate.

    Next issue: Do you “oversubscribe” the host memory? That is, does the sum of the UML memory sizes exceed the size of the host’s real application space? If so, the host swapspace is used, causing disk activity at this level. This is independent of the swap activity within each UML as the user exceeds its “real” space and begins to use its swap partition. I’m guessing that host-level swapping does not count against any UML’s bucket. but that UML-level swapping does. This would be tha fair way to do this. However, host-level swapping will reduce the overall amount of IO resource that is available to the users. The algorithm above will account for this.

    Next issue: Do we have fairness issues with network bandwidth? do you intend to add a token system to address this?

    Again: I’m a happy camper. These are purely theoretical questions for me.

Kommentar abgeben

Ihre E-Mail Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit *gekennzeichnet