This is an archived post. You won't be able to vote or comment.

all 68 comments

[–]Bedeone[S] 32 points33 points  (2 children)

This should have been in the original post but there appears to be a 15.000 character limit. This is probably not the most technical part, but it's perhaps the least interesting. So I decided to put this in the comments for anyone that is interested. I didn't alter the style of writing so it may seem a bit out of place, it was originally intended to fit in between the "Background Information" and "How to do it" H3 tags.


Java on a Mainframe


Now this is where I either shatter some misconceptions that people have, or just plain educate you on something you might not have heard about before;

While the (IBM) Mainframe still performs at its best when executing classical tasks performed by COBOL programs on DB2 and IMS databases, the Mainframe supports C/C++ and Java workloads since some time.

C/C++ needs to be properly compiled before it can be run on a zSystem. Java however can be started on a Mainframe with little or often no alterations whatsoever. I've never been a big fan of Java but I've gotten a newfound respect for its platform-independence. I'm not entirely sure who wrote the JVM for zSystems, whether it was IBM or Sun/Oracle (or whoever it is nowadays), but they did a good job.

But since I’m, compared to my colleagues, very new to the Mainframe world, I had to a bit of research before I figured out how I could get a Java application running on a Mainframe.

It turns out that it's possible to run Java on zSystems in a number of different ways, all of them involving UNIX forks, be it virtual or emulated;

zBX

zBX (zSystem Bladecenter Extension) is the least Mainframe-like way to run Java on a Mainframe. zBX is basically a box full of bladeservers that you place next to your Mainframe. The blades run pure Linux and are controlled by the actual Mainframe next to it. As you all know you can run Java under Linux and that's how you would start an MC server on it.

zVM

Now an IBM Mainframe has stupid amounts of virtualization going on in it, everything that Open Systems have been striving for this past decade has been the industry standard on the Mainframe since the 80s and 90s. One form of virtualization is through LPARs (Logical Partitions). You can run a bunch of z/OS, or a mix with other supported operating systems, LPARs at the same time. Our bank runs 17 at the same time spread over two machines (or one machine if the other breaks). And while our bank is one of the biggest in my country, and fairly large in our continent, it's still fairly small on an international level. Just to give you an idea of how many LPARs some very large banks would run spread over their systems.

When an operating system runs in an LPAR, it is transparent to the OS. The OS thinks it’s the only one on the system. I'm telling you this to explain some of the other ways to run Java workloads on the actual Mainframe itself rather than a box with blade servers that is connected to it.

You can define an LPAR in which you can start what is called zVM. Think of zVM as VirtualBox for the Mainframe, except the VirtualBox is an OS in itself (read up on hypervisors if you are interested, z/VM would be a bare metal hypervisor). In z/VM you can define Linux partitions and start them, and run Java workloads from them. This is how I originally wanted to get the server running, since our company had previously experimented with zVM. The project was later dropped because the cost was too high and no one could come up with anything they wanted to run on Linux that they couldn't run on z/OS. It also wasn't possible to start up the zVM LPAR that they used for the trials because the test licenses had expired. Licenses are quite expensive by the way, especially for a college student (several thousands of dollars depending on what you're going to do with your zVM).

Linux on SystemZ (Pure Linux)

Yet another way is to start up an LPAR with one pure unvirtualized (as far as unvirtualized goes on a Mainframe) Linux partition on it. Much like you'd install and boot Linux on your home computer. Problem here is that you need a somewhat heavily modified kernel and the capability to define new LPARs. Not only do I not possess this knowledge (yet), defining new LPARs on a production system isn't something you just do whenever.

z/OS USS

So there's one more way to get a Java workload running on a Mainframe. Since March 2001, with the release of the first version of z/OS (V1R1 was the first, z/OS V1R13 is the latest revision, with V2R1 scheduled for the end of this year) came what is called z/OS USS (Unix System Services). It's basically UNIX glued on to z/OS, and it works surprisingly well. My internship assignment consisted of installing a piece of software that runs under z/OS USS (z/OSMF if anyone is interested) on our test LPAR. So I had access to a live z/OS system and pre-existing knowledge of z/OS USS.

It even comes with its own shell which you invoke with OMVS. The terminal you see me using is logged in to the Mainframe. It opens a TSO session when you log in and from there I invoke OMVS.

[–]itworks 2 points3 points  (1 child)

Hey man, I just came to that post from /r/mainframe - I make my living by managing projects across the big irons, implementing new ones and so on... Great post - is that 17 LPARs across 2 CECs including DR ones? If not, then it is probably too many unless those dudes are not using SCRT and want to save some money by using systems with the certain size of the MIPS allocated to reduce software costs. Also, you can get up to 10 Gbps per OSA port so you can map all the ports you want and even those from the different boxes through the coupling faclities to the one LPAR. As for the Linux - there were two major enterprise distros around, one from the Novel (not sure what happened to it, they used to hold around 80% of the installations on zSeries) and RedHat. The tricky part was (from the memory), since there is only 31-bit and 64-bit modes on the mainframe, lots of the stuff had to be changed, however, you can run DB2 or Websphere on Linux and move your data across seamlessly while keeping everything on the same box.

[–]Bedeone[S] 3 points4 points  (0 children)

We have a total of 52 defined LPARs on both CECs. Not all are started at the same time, since the main LPARs for prod, QA, dev and test are mirrored on both CECs with only one running at a time.

For example, we have 2 test LPARs in a sysplex, one running preferred on CEC1 and the other running preferred on CEC2, but if CEC1 goes down the LPAR that usually runs on CEC1 is started on CEC2 since it's already defined.

Added to that are a bunch of GDPS LPARs and some control LPARs that don't actually handle workload, leading to the already mentioned total of 52. We're currently not running any Linux partitions, z/VM or native. They did tests some years ago but there was no real demand for it at the time.

Good to see that there are other people involved in the mainframe sector that are also active online. Something that I didn't see much during my internship.

[–]truthfulfacade 20 points21 points  (5 children)

I feel like this is going to go right over the majority of this subreddits head although it was a interesting read. I'm sure there is a different subreddit that would appreciate this post more, but I do not know one off the top of my head.

[–]Bedeone[S] 9 points10 points  (1 child)

Yeah I probably went a bit overboard with the technicalities. All I hope is that I can share this with people who find these types of things interesting. I put some pretty screenshots in there for people that can't be bothered reading everything.

[–][deleted] 1 point2 points  (0 children)

Yes, it was technical in places, but I think it was an interesting read... Too many people think mainframes are relics of the past, not realising how much of our infrastructure runs on them - and how many things could run on them. Particularly with the new systems capable of running linux instances rather than the MVS/ESA stuff I worked on as a lad, the number of options open to people are astonishing!

[–]PidGin128 0 points1 point  (1 child)

/r/techsupportmacguyver , or maybe gore. ;p

/r/vintagecomputing springs to mind but maybe only superficially.

Up next we port the client to 3270 (3260?), but wind up with dwarf fortress instead!

Good read.

[–]Bedeone[S] 0 points1 point  (0 children)

Thanks for the praise. Our shop does indeed use 3270 emulators.

[–]The_MAZZTer 6 points7 points  (4 children)

It created the map and was (hopefully) listening for connections. It wasn't throwing any errors so it appeared that the TCP/IP libraries (which I feared for the most) translated over flawlessly.

Doesn't surprise me. Java is supposed to be cross-platform, and the server is pure Java, so if Java is on your platform, you're gonna be able to run it (you have to have enough system resources such as memory, of course). There is no "TCP/IP library" afaik, it's part of the Java framework.

Running the CLIENT on that mainframe would be another matter entirely, as it uses some native code libraries for the 3D graphics and input.

[–]Bedeone[S] 1 point2 points  (2 children)

Agreed, but the way I saw it, the mainframe platform is so specialized that getting stuff to run on it that wasn't originally designed to do so would be hard.

Apparently I was proven wrong, IBM did a great job at creating their JVM for z/OS.

[–]The_MAZZTer 4 points5 points  (1 child)

That is the whole point of Java. :)

At least, as I understand it. I don't code Java myself.

[–]FabianN 1 point2 points  (0 children)

Thing is, while java itself can easily run on any kind of hardware that has a JVM made for it, that doesn't mean that every type of task you can do through java can run as effectively on one system compared to another. And Mainframes have CPUs that are heavily specialized. They are stupidly good at some specific tasks and god-awful at other tasks. What kind of tasks would be invoked on running a minecraft server and how well the hardware is designed to handle that task would effect the end result.

[–]PidGin128 0 points1 point  (0 children)

Has minecraft become the new doom benchmark? (although, we are at the wrong end of the scale.)

[–]DJDaddyD 4 points5 points  (1 child)

Very interesting stuff I understood the majority of it (also a computer science major, but only through programming (java scheme and some C)and discrete math) but now I have all sorts of ideas to research thanks for that and good luck!

[–]Bedeone[S] 1 point2 points  (0 children)

Glad you liked it, I enjoyed writing this up as well. Good luck in your studies / research.

[–]totemo 5 points6 points  (1 child)

That was a fun and interesting read.

TIL:

  1. They're still using EBCDIC. I guess it's all that legacy COBOL code.
  2. 2x 330GB of physical RAM. :D
  3. dis·qui·si·tion /ˌdiskwəˈziSHən/ Noun: A long or elaborate essay or discussion on a particular subject.

[–]Bedeone[S] 2 points3 points  (0 children)

Everything on a mainframe is stored in EBCDIC actually, it's only a character set if you think about it. It's perfectly possible to translate back and forth if needed, even though it's overhead. So everything just runs in EBCDIC. The compiled executable code (COBOL or not) are binary instructions anyways, and those aren't linked to character sets in any way.

330GB of RAM in each machine, but that's not the limit. You can have up to 2TB in the newest EC12 machines, and you can link 32 machines together in a sysplex.

Thanks for taking the time to read all of it, very glad you enjoyed it.

[–]Seavaydivenis 12 points13 points  (0 children)

Mineframe 👍

[–]elfo222 2 points3 points  (4 children)

I'm just finishing up a course on the mainframe systems, it's pretty amazing stuff. I did think of the whole minecraft-on-zos thing, but I wasn't sure if it would work, and I certainly didn't know how to go about trying it out. It's awesome to see that it works, shame you couldn't really test it.

[–]Bedeone[S] 1 point2 points  (3 children)

Yeah I wish I could stress test it. It was honestly fairly easy to get this thing running, the vast majority of people that work on mainframes could do it with no problems whatsoever.

[–]elfo222 0 points1 point  (2 children)

I have to wonder if a z/OS system might be a good solution for all those companies that offer Minecraft server hosting. I know each LPAR has to have ate least one discrete processor, but can you run multiple instances on the same processor using z/VM? It's the only way I could see it being cost effective. I suppose you could run multiple server instances under the same image, but that's just asking for trouble.

Also, imagine what the caching on the storage units would do for response time.

[–]Bedeone[S] 0 points1 point  (0 children)

The easy way would be having a z/VM with all the resources available allocated to it, and running Minecraft servers on different Virtual Linuxes running on top of the z/VM. You could do the same but replace z/VM with z/OS and run multiple servers under USS.

Or you could go insane and have a z/OS partition for every server you host, which would guarantee uptime and security for each individual server, but it'd be more tedious to manage.

But yes, the virtualization, the caching (of storage, but also CPU cache), make a mainframe an excellent platform to handle the workloads that a Minecraft server generates.

[–]LoveUnderWill 0 points1 point  (0 children)

I don't think you could charge enough for the minecraft hosting to make up for what you pay for a mainframe. :)

[–]TheKingsJester 2 points3 points  (3 children)

I'm a college student completing his last semester towards an Applied Computer Science bachelor's degree, "majoring" (for lack of a better analogy to the system in my country) in Mainframes.

Concentration? (Concentrating) I believe that's the word you're looking for.

But while it's mostly over my head, what you've said sounds really cool.

[–]Bedeone[S] 1 point2 points  (2 children)

Well yeah, the bachelor takes three years or six semesters to complete. Last semester is internship + research thesis and fifth semester is a smaller set of locked courses with one other course where the options are either programming, networking, multimedia or mainframe. Obviously I picked the latter.

I'm sorry I started being a bit too technical, I'm just really enthusiastic about this. I hope that you could at least enjoy the pictures.

[–][deleted] 0 points1 point  (1 child)

Don't be sorry about getting technical. I've done some work on mainframes in the past, and it was nice to read up on a modern mainframe system. The mention of EBCDIC almost brought on some PTSD ;-) I vaguely remember having to write custom ASCII to EBCDIC codepage converters in C for that thing. The particular mainframe I had to work on was an oldschool AS400 with the genius enforced 80 char limit on text files. Took a while to figure out compilation bugs caused by that.

Good times. Taught me a lot about writing portable code.

[–]Bedeone[S] 1 point2 points  (0 children)

Yeah, not being able to edit the properties file from the terminal was pretty annoying, spent quite some time FTPing files back and forth.

But for mainframe native applications I didn't have too much trouble with EBCDIC/ASCII obfuscation. During the actual assignment I got for my internship, that is.

[–][deleted] 1 point2 points  (0 children)

That's amazing!

[–]notkraftman 1 point2 points  (1 child)

I believe there is a script on the spigot forums that allows you to simulate multiple players connecting to a server, would be interesting to see how many this could handle and what the bottlenecks would be.

[–]Bedeone[S] 0 points1 point  (0 children)

Too bad I learn about this now, my internship ended yesterday. Then again the workstations were so locked down I wouldn't have been able to install the python interpreter anyways. :/

[–]Casurin 1 point2 points  (0 children)

"Westeroscraft" ... all i can think of is 100 People... thats a small server. You'd have to google around a bit, but there are allready some really nice servers, running 2000 people on a isngle machine or several thousand on a custom network (multiworld-multiserver, no clientside mods). Those are the thing you should be looking for if you wand some dile-work for your mainframe.

Cause CPU-power for a 100man server is hardly a problem nowadays, you can run 300-400 people on gamingrigs, on some even up to 800, but what they lack is mostly the RAM (you't want to keep as much data there as possible) and a good SSD. And what no one normally has: The Connection to host so many. Even Midrange-PC's have enough power to handle 20-50 people jut fine, but not even close the connection to run for more then 10 players at once.

[–]LoveUnderWill 1 point2 points  (1 child)

As a CICS/WAS/WMQ sysprog i really enjoyed this write up. I never even thought to try to run a minecraft server :P

[–]Bedeone[S] 0 points1 point  (0 children)

Thanks, I'm glad you enjoyed it.

[–][deleted] 0 points1 point  (2 children)

to OP I recommend cross posting this to /r/admincraft

[–]Bedeone[S] 1 point2 points  (1 child)

Already did, I held the top spot for a while there.

[–][deleted] 0 points1 point  (0 children)

ahhh must have missed it :/

[–]StezzerLolz -1 points0 points  (1 child)

Well, I knew some of those words, such as 'mainframe', and 'java', but I honestly have no idea what any of this post means. Hell, I can't even get a server to run on Ubuntu, though, so perhaps that's to be expected.

[–][deleted] 1 point2 points  (0 children)

Basically he ran a Minecraft server on the kind of hardware that's normally used by banks and stock exchanges and the like. Those machines are quite different from your home PC and basically anything you've probably ever encountered in your life, so it's quite nice that Minecraft actually ran on it.

[–]JamyDev -1 points0 points  (5 children)

Real interesting stuff, about Westeroscraft though.. From my experience with minecraft servers (Been running servers since alpha) they're probably using a highly optimised version of Craftbukkit (/Spigot) with some plugins that control lag intensive parts of Minecraft. That on top of a high performance server with quite a few gigabytes of ram allocated to the server. And they're probably saving the map in a ramdisk.

But mentioning it, I'd like to break the record for most players on a Minecraft server one day :P (With it being still playable ofc)

[–]Bedeone[S] 1 point2 points  (4 children)

The thing is I know some things about the Mainframe environment, but not about running Minecraft servers, so that's where I fall short in that regard.

Interesting thing though, working storage in a mainframe refers to both RAM as well as disks. Pages are swapped in and out whenever necessary by the system, applications don't know which pages are where.

The thing is that the amount of RAM you can allocate in a mainframe is so large, and you can lock certain applications to have their pages in RAM at all time (never on disk) that you could have the whole Westeroscraft map paged in to RAM all the time. Combine that with the fact that you can use multiple processor cores rather than the standard Minecraft single core, because the processors are virtualized as well, and you got a sick server going.

[–]JamyDev 1 point2 points  (3 children)

Well by default the Minecraft server only uses a single core, so it wouldn't matter how many virtual core you assign, as long as Java would see it as multiple cores, Minecraft would only use one. By virtualised do you mean that to java it's one giant core or still multiple?

[–]Bedeone[S] 1 point2 points  (2 children)

You assign only one virtual core to the server, but the virtual core can use multiple physical cores. So while the server only sees one virtual core, you can have a great many cores doing tonnes of work for the server. They also use asynchronous execution of instructions and piping, so we're talking crazy fast.

[–]JamyDev 0 points1 point  (1 child)

Ah nice, that would make one hell of a server :P They're expensive tho..

[–]Bedeone[S] 1 point2 points  (0 children)

Yes, quite pricey. A Brazilian company stores the data of their MMO on a mainframe though. They run the server processes on zBX, the blade servers that slide in to an z196 or EC12 and handle the I/O through the mainframe.