ThinClientMemoryUsage

  • Launchpad Entry: thin-client-memory-usage

  • Created: 2005-11-03 by Scottbalneaves

  • Contributors: Scottbalneaves

  • Packages affected:

    • ltsp-server/ltsp-server-standalone/ltsp-client

Summary

In order for Dapper to be considered as a solution for breathing new life into old machines by using them as thin clients, Dapper will have to be able to boot thin clients that have as low as 32 megabytes of memory.

Rationale

There are a lot of older machines out there, and one of the huge selling points of any thin client GNU/Linux solution will be to use existing, older hardware that's unable to be used with other operating systems. Developing countries, schools, non-profits, and cost-conscious companies will all be interested in taking advantage of hardware they already own.

Use cases

Jeff has an old lab with a bunch of old Pentium 120's with 32 megabytes of memory. He's been informed that to upgrade his current operating system that he bought in 1998, to the current one will be both expensive and painful, as it will require him to replace all of his lab machines. However, he hears about Edubuntu on Slashdot, and downloads a Dapper Drake Ubuntu CD, and within a few hours, he's got it installed on a spare file server. He shows his boss the shiny new lab with great educational software without having to upgrade a single workstation, or buy a software license.

Scott is a systems administrator at a government agency that is chronically underfunded. His boss wants email, web browsing, office suite, and other applications on every box, but tells him he must do it without upgrading machines, as, "it isn't in the budget". His friend Oliver meets with him for lunch, and gives him a Dapper Drake CD, and offers to come by and help to get it installed. It fits the bill perfectly, and Scott's boss is impressed with the speed, and ease of administration. She tells him to deploy it in some of their out of town offices as well.

Amina and Tiye are the founders of a small start up company working on an embedded thin client kiosk solution to be used in homeless shelters in a developing country. Money's tight, being a startup, and their kiosk portal's a web based solution, but they need something to power the minimal kiosk machine. Dapper once again to the rescue, and the embedded boards they chose to use (with only 48 megs of ram) work wonderfully.

Design

To provide the thin client with the thinnest possible footprint, the following steps are needed:

  • Eliminate the loading of the restricted modules. The nVidia drivers usually aren't needed on a thin client anyway.
  • Blacklist modules if a "nolocaldevices" (name arguable) option is set in lts.conf, avoid loading of ide, floppy and other modules local device related modules through the new modutils/blacklist.d mechanism the new modutils will introduce in kernel 2.6.14/15. All modules like pcmcia support, parport bluetooth and drivers that are not essentially needed at all for running and using a thin client will be blacklisted by default. (see Udev Roadmap for more information).

  • Reduce the amount of video ram needed by the client. We should calculate how much is needed to do 1024x768 in 16 bit colour (reasonable for most older machines) and set the VideoRam parameter appropriately in xorg.conf. The administrator should have the ability to manually set this value up or down, depending on if his local clients have more or less memory.

  • On the server, provide some kind of nbd swap daemon so that when a thin client does run out of ram, it will simply get a bit slower, as opposed to hard failing because ram's been exhausted.

Implementation

  • Removing unnecessary modules and startup scripts will not only reduce memory, but will speed up the booting. This is being handled by ThinClientFasterStartup.

  • Remove the restricted modules, and the ramdisk that holds them. This will free up to 12 megabytes of ram. this will be achieved by only installing the kernel package instead of the metapackage through the ltsp-build-client script which is required to be fixed for multiarch and support for powerpc anyway see code section for more detail.
  • Limit the X.org video memory to 2048 kilobytes by default. Add the appropriate shell scripting into ltsp-client-setup to read the X_VIDEORAM parameter from the lts.conf file and pre-seed the debconf value for configuring the xorg.conf file. This will allow the administrator to easily set it up or down as needed.

MattZimmerman: there must be a simple way for the administrator to restore the old behaviour of using all available video memory. Even if we are confident that 2 megabytes will be sufficient for almost all thin clients in the field, we must retain this capability.

  • Each getty running on a console uses up memory. Reduce the number of gettys being spawned in the inittab to save memory. You should need one or two at the maximum.
  • Use swap over nbd to provide a virtual memory solution. If the terminal runs out of ram, it will begin swapping over the network, and slow down considerably, but this is preferable to having the thin client crash or reboot due to memory starvation. The LTSP project has modified the nbd-swapd server to automatically create the swap file on connect if it hasn't been created already. This saves the Ubuntu server administrator the task of having to do this as a manual process. The source for ltsp-swapd can be found at:
    • cvs -d :pserver:anonymous@cvs.ltsp.org:/usr/local/cvsroot co ltspswapd

  • Since we run the nbd swap space on the ltsp server, we can just set SWAP_SERVER="$nfs_server" in /usr/lib/ltsp/ltsp_config in the chroot for the Thin Clients as well as setting NBD_PORT="9210" (the default port ltspswapd uses). ltspswapd needs to be packaged.

* For Ubuntu 8.10 (and maybe before), it is sufficient to add "NBD_SWAP=True" to the [default] section of lts.conf to add 32Meg of swap.

Code

  • Videocard memory problem:
    • Preseed the debconf value xserver-xorg/config/device/video_ram to 2048 byte as a default in /etc/init.d/ltsp-client-setup, but make it respect a different value from lts.conf if one was set.
  • Inittab change:
    • The change to intittab to disable unneeded getty processes should be done from the ltsp-build-client script.
  • Change in ltsp-build-client to avoid the restricted modules package:
    • Look up the most actual version for linux-image-X.X.XX-X-${arch} in the archive (by checking the dependencys of the linux metapackage) and install it with ltsp-build-client to avoid installing the metapackage and thus the linux-restricted-modules package.

Comments

  • JonathanCarter: I think a 64MB RAM requirement 2 years ago would be a lot for refurbished PC's. Having said that, most "old" PC's in circulation these days do have 64MB or more RAM. Having said that, I think there is a lot that can be shaven off of the ubuntu ltsp environment, and it seems likely to come down in memory. I think swap over nbd will make this slightly less of an issue.

  • PhillipSusi: I'm confused by the talk of limiting the video memory. The machine is going to have a fixed amount of video memory in it depending on the video card, telling the X server to not use it all seems rather pointless.

    • OliverGrawert: Parts of the video memory get shadowed into the main memory, so if you run a low profile client with a high/mid end videocard, it can occur that it cant start the X server because the kernel already occupies to much memory, (the ltsp people and me did a fair amount of testing where problems like these were identified and written down in this spec at the shared ubuntu/ltsp conference in Montreal), see the comment from mdz, the spec is not fully done yet (especially in the videoram area) but we will very likely default to the lowest possible value.

      • PhillipSusi: Could you elaborate? As far as I know, only the video rom bios gets shadowed into ram. Also cheap integrated video usually slices off a chunk of main ram for the video buffer rather than using dedicated VRAM, but telling the X server not to use it all does not allow the rest to return to the free memory pool, because the bios has already marked it as reserved in the memory maps it passes to the kernel. In order to free up these chunks of ram, you have to fiddle with settings in the bios.

      • OliverGrawert: Please assemble a 48MB Thin Client with a 128MB videocard, apply all changes described in this spec to make it boot and test yourself .... might be related to the size of the BIOS or to something else, in no case it will boot cleanly as long as you dont limit the videoram the X server allocates... can we please discuss this not on the spec page as long as i'm working on the spec ? i dont want to clutter it with a long comments thread, feel free to mail me personally or to discuss it on the edubuntu-devel list with me.

  • FrancisGiraldeau: There are some applications that does caching and rendering with the X process, that runs on the terminal. This a critical issue. Look at some results of experiments I did about problems related to OpenOffice and Firefox.

    • XavierBrochard: Same problem with Kpdf (according to the kpdf developpers) and probably Evince. I added a note about it on results of experiments

    • Torsten Eichstädt: How about swapping to an iSCSI device? This is truely portable, as opposed to nbd, which is bound to the Linux OS (and hence propietary, although open source). Using iSCSI whenever accessing raw devices lets LTSP integrate easier to (larger) sites that have a SAN housing storage devices of diverse vendors, with various (special storage related) OS. This could be a step towards my vision of Linux OS on the thin client (because of good support for consumer devices like cameras, external storage, MP3 sticks, USB sticks, PDA, etc.) and whatever OS you want at your server (OpenBSD for best security, OpenSolaris w/ or w/o linux branded zones, free capacities on your Big Blue Mainframe with Linux/Z, or whatever)


CategorySpec CategoryEdubuntuSpec

ThinClientMemoryUsage (last edited 2009-07-24 03:12:16 by 201)