Zero and Shark article

This past month or so I’ve been working on an article about Zero and Shark for It went live today, so if you fancy a little primer on what Zero and Shark are and how they work then head over there and check it out :)

21 thoughts on “Zero and Shark article

  1. Hi Gary–nice article, helpful to get the bigger picture of what you’ve been working on (keep the blog entries coming, too, please!).

    If I understand correctly, the server JIT in HotSpot also contains a bunch of assembly, but also a portion in C++. correct? What I’m wondering is if with Shark, you are forced to lose the entirety of the server JIT optimizations and replace them with LLVM optimizations? Or can you use a portion of the HotSpot server JIT excluding those parts in assembler? From what I’ve picked up, the server JIT has a pretty sophisticated set of optimizations built up over time.

    A second question is whether the profiling in the HotSpot interpreter, when running in mixed mode, is still used when running Zero? That is, do method call in Zero still get tracked, profiled and triggered for JIT compilation? Or is that lost in the port?

    Thanks, keep up the good work!

  2. Damon, it’s be interesting to see how well Zero ran Tomcat (Shark is still a bit wobbly on ARM, but it’s being worked on). Zero is very slow for compute-intensive stuff (such as building packages) but I hear it’s not too bad for interactive stuff. How much RAM do ARM things typically have?

    Patrick, Shark uses a part of the server JIT (the typeflow pass) but most of the optimizations are not in that. A couple of times now I’ve looked at making it use more, but some of them definitely cannot be used with Shark and it’s hard to pull bits out piecemeal.

    As for your second question, yes, if you’re running Shark then the process that selects methods for compilation is exactly the same. It should even be able to support tiered compilation, so if at some point Shark gains some expensive optimizations it would be possible to have them in higher tiers.

  3. Gary and Damon: Tomcat runs quite well on ARM using zero.

    I have tested this on a Marvell SheevaPlug ARM computer with 512Mb ram that comes pre-installed with Ubuntu Jaunty.

    The startup time to initialize tomcat are about 10 seconds then when it are up and running it processes further pages in about 100ms using zero.

    S 82 ms 0 KB 0 KB GET /manager/status HTTP/1.1

    Apache Tomcat/6.0.18 1.6.0_0-b14 Sun Microsystems Inc. Linux arm

    java -version
    java version “1.6.0_0”
    OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu6)
    OpenJDK Core VM (build 14.0-b08, interpreted mode)

  4. Damon: I have to rely on the power measurements done by Laurent GUERBY.

    He measured the SheevaPlugs power usage to:
    2.3W Idle with everything unpluged
    3.3W Idle with gigabit ethernet
    5.0W Idle with gigabit+HDD USB+serial
    7.0W +100% cpu

    So depending on if you will use a attached USB HDD or not I would expect power consumption to be between 5W to 7W during Tomcat startup and 3.3W to 5W when the system are idle.

    A 5W main Internet-facing server here we are! :)

  5. Yes, sounds very plausible, thank you. I intend to work towards such a replacement within a year or two.

    Now I just have to accommodate my 50GB+ of read-occasionally/write-very-rarely primary data power-efficiently, and squeeze the front-end Web-facing cache into (say) 256MB where I currently use about 4x that minimum, and I am good to go. B^>

    (Plus my data monitoring, NTP service, SPAM-battered sendmail, etc, etc!)



  6. Discussions started here:

    and here:,23233,23239#msg-23239

    It would be really cool (in a power-consumption sense) to get more small Web sites onto these sort of devices rather than big dedicated hungry hosts.

    I’ve just starting hacking on my Gallery code:

    to get it down from straining at 1GB minimum physical memory (512MB for the Gallery’s VM) down to half that. I have some ideas… B^>



  7. Yep.

    Actually I’d like something with a little bit of direct digital discrete I/O so I don’t need to use my K8055 board, and either support for more SDHC or direct drive for an external low-power HDD or SSD for my ~160GB of bulk data, or another USB so I could plug both those peripherals in without a USB hub. I think that in principle I could bring one of those (SATA for example) out from the plug, and I don’t think the Open RD client gives enough more to be worth the extra space and cost (and probably consumption).

    Still, I’ve just done an initial tweak of my main Web app so that it’ll run comfortably within 256MB-ish, down from ~1GB minimum, ie less than half of the physical memory of the plug. Mainly took all night thinking (and working on another aspect) and then about 10 lines of code… B^>



  8. Ah ha! Now about 30 miles from me in a FedEx depot, though I’m so busy over the next couple of weeks that I doubt I’m going to get my teeth into it much before they’re gone!

    Of course, to get to be its come from China via the US, ie about 2/3rd of the globe the wrong way, by air, eating up goodness knows what portion of any possible emissions savings… This has to be written down to ‘showing that it can be done’ I think! %-P



  9. Nah. I don’t own a car at all.

    My plug arrived yesterday but now I’m too busy to do anything with it for a fortnight, except plug it in to see what it consumes ‘out of the box’: ~7W as-is and ~8W with a SD card and USB memory stick and Ethernet connection plugged in…

    But my main server now runs comfortably in 256MB instead of more than twice that…



  10. Well, my mains power meter is showing ~6W with a new-ish kernel, idle-ish system, and Ethernet connection. But this meter sometimes reads 3W with nothing plugged in… I’ll have to wait until I switch to DC power to get a better idea.

    Still, less than half of my laptop at its quietist, so time to get Zero+Shark very very soon!



  11. Note to Xerxes: with my DC power meter I can more-or-less confirm your readings, especially at the low end, with the V1.0 SheevaPlug installer based on the kernel with ~4 wakeup per second.

    Just plugging in a USB hub (with nothing downstream) adds an extra 10 wakeups per second and ~1W when idle!



  12. All done… Just moved the last of my services to the SheevaPlug from my previous laptop/server and powered down the now-unfashionable one!

    Power dips as low as 2.5W still, though now the plug is busy fighting off SPAM, etc, and the Ethernet light is active fairly continuously, I don’t expect it to be there often.

    4W or 5W is more typical, from DC, running entirely from my small off-grid solar PV system, so job done.

    Thanks for all the help along the way!



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.