hw6.pdf

2
Comparison of Possible Languages for an Alternative Docker Implementation Dustin Rudiger University of California, Los Angeles Abstract This paper examines alternative languages with which to implement Docker, a platform for distributed applications that allows the building, running, and shipping of any app, anywhere. Docker is implemented in Go, and I will dis- cuss the benefits and disadvantages of using Java, Python, or Scala to implement an alternate version, DockAlt. The goal is to have DockAlt to fall back upon in case of an issue with the single, main Docker source code. I conclude by recommending the use of Python to implement DockAlt. 1 Introduction This research is motivated by the need for a framework to support a dynamic, Wikimedia-style service for news where flexibility and efficient service for mobile users is a priority. The Wikimedia architecture is used by Wikipedia and its related sites, and runs on the LAMP platform, which uses multiple, redundant web servers behind a load-balancing virtual router for reliability and performance. However, my team’s news service will have much more frequent updates, must be accessible via various protocols, and must accommodate more mobile clients. For these reasons, we feel the Wiki- media application server will be a bottleneck and are looking into the architecture called an “application server herd”. I intend to evaluate the pros and cons of using the Twisted framework to implement this archi- tecture for our service. 2 Docker Docker was created to solve the problems developers have when creating software on and for a variety of platforms: getting all parts of the software to work on all of the platforms, addressing dependency issues, and conflicts due to certain quirks of different platforms. This requires a large breadth of knowledge of the dif- ferent platforms and interactions, and can sometimes be complicated when bugs exist in the tools or platforms, since the developer probably isn’t able to patch the 3rd- party source code. Many times virtual machines must be created and a lot of trial-and-error work must be done to get everything working together. Docker provides a solution through the use of Linux containers (LXC), which compartmentalize the different software compo- nents, allowing them to be correctly interpreted and implemented on any platform. 3 Why Go? Docker chose Go for a variety of reasons. It was a neu- tral language, so users wouldn’t be biased against it like they might be against popular languages like Java, and it was mostly platform-independent. It also has concise, easily-readable syntax. This was important, since Go’s ease of learning and use allowed many members of the community to contribute and grow the project. On the technical side, Go’s static compilation, good asynchro- nous primitives, low-level interfaces, extensive standard library and data types and strong duck typing together made a strong argument for it. It also has a full devel- opment environment, which includes features like re- trieving documentation for any package, pulling from GitHub, fixing spacing inconsistencies, a test frame- work, and rapid script-like prototyping. It also allows a multi-arch build without the use of preprocessors and by default generates native binaries without any external dependencies. It does have a few drawbacks though, mostly features other languages have that it lacks (an IDE for example), and inconveniences that require a slower workaround. 4 Java Java’s widespread use would allow many programmers to contribute, but its complexity might discourage those who don’t know it already as well as make contributing more tedious. On the plus side, Java is very reliable and safe, in part due to its strong static typing and compile- time checking. However, it’s more verbose than Go, so code would take longer to write and read. Prototyping would also take longer, and the development cycle would be slower. One of the biggest issues is the lack of support for LXC binding, one of the integral parts of Docker. It would be possible to solve this by using the Java Native Interface, but this use of native libraries

Upload: dustin-rudiger

Post on 08-Jul-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Comparison of Possible Languages for an Alternative Docker Implementation

Dustin Rudiger

University of California, Los Angeles

Abstract

This paper examines alternative languages with which to implement Docker, a platform for distributed applications

that allows the building, running, and shipping of any app, anywhere. Docker is implemented in Go, and I will dis-

cuss the benefits and disadvantages of using Java, Python, or Scala to implement an alternate version, DockAlt. The

goal is to have DockAlt to fall back upon in case of an issue with the single, main Docker source code. I conclude by

recommending the use of Python to implement DockAlt.

1 Introduction

This research is motivated by the need for a framework

to support a dynamic, Wikimedia-style service for news

where flexibility and efficient service for mobile users

is a priority. The Wikimedia architecture is used by

Wikipedia and its related sites, and runs on the LAMP

platform, which uses multiple, redundant web servers

behind a load-balancing virtual router for reliability and

performance. However, my team’s news service will

have much more frequent updates, must be accessible

via various protocols, and must accommodate more

mobile clients. For these reasons, we feel the Wiki-

media application server will be a bottleneck and are

looking into the architecture called an “application

server herd”. I intend to evaluate the pros and cons of

using the Twisted framework to implement this archi-

tecture for our service.

2 Docker Docker was created to solve the problems developers

have when creating software on and for a variety of

platforms: getting all parts of the software to work on

all of the platforms, addressing dependency issues, and

conflicts due to certain quirks of different platforms.

This requires a large breadth of knowledge of the dif-

ferent platforms and interactions, and can sometimes be

complicated when bugs exist in the tools or platforms,

since the developer probably isn’t able to patch the 3rd-

party source code. Many times virtual machines must be

created and a lot of trial-and-error work must be done to

get everything working together. Docker provides a

solution through the use of Linux containers (LXC),

which compartmentalize the different software compo-

nents, allowing them to be correctly interpreted and

implemented on any platform.

3 Why Go? Docker chose Go for a variety of reasons. It was a neu-

tral language, so users wouldn’t be biased against it like

they might be against popular languages like Java, and

it was mostly platform-independent. It also has concise,

easily-readable syntax. This was important, since Go’s

ease of learning and use allowed many members of the

community to contribute and grow the project. On the

technical side, Go’s static compilation, good asynchro-

nous primitives, low-level interfaces, extensive standard

library and data types and strong duck typing together

made a strong argument for it. It also has a full devel-

opment environment, which includes features like re-

trieving documentation for any package, pulling from

GitHub, fixing spacing inconsistencies, a test frame-

work, and rapid script-like prototyping. It also allows a

multi-arch build without the use of preprocessors and by

default generates native binaries without any external

dependencies. It does have a few drawbacks though,

mostly features other languages have that it lacks (an

IDE for example), and inconveniences that require a

slower workaround.

4 Java

Java’s widespread use would allow many programmers

to contribute, but its complexity might discourage those

who don’t know it already as well as make contributing

more tedious. On the plus side, Java is very reliable and

safe, in part due to its strong static typing and compile-

time checking. However, it’s more verbose than Go, so

code would take longer to write and read. Prototyping

would also take longer, and the development cycle

would be slower. One of the biggest issues is the lack of

support for LXC binding, one of the integral parts of

Docker. It would be possible to solve this by using the

Java Native Interface, but this use of native libraries

would destroy the portability, which is incredibly im-

portant for an application like Docker. Thus Java isn’t a

viable language with which to implement DockAlt, un-

less we know for sure we won’t ever be in a situation

where this lack of portability would be a problem (but

still probably not futureproof).

5 Python Python is similar to Go in that it’s easy to learn, write

and read, so it would encourage contribution. It also has

strong dynamic duck typing, which allows flexibility but

can result in runtime errors and less reliability, just like

Go. It’s concise, and with Python pip, an LXC interface

package can be downloaded to allow fast prototyping.

Pip also enables a better source control management

system, since one of Go’s issues is not being able to

select a certain version when pulling. Python might

have worse performance though since it uses an inter-

preter instead of a compiler, which is big disadvantage

since DockAlt isn’t the main application and should be

as lightweight as possible to avoid introducing over-

head. However, since DockAlt will only be used as a

backup, this might be an acceptable tradeoff.

6 Scala Scala shares similarities with both object oriented and

functional programming languages. Every value is an

object, and every operation is a method call. Functions

are objects as well, similar to a class. From the func-

tional side, Scala can do pattern matching, which is

powerful. It’s strongly and statically typed, which con-

tributes to its reliability. However, it’s harder to learn

and use than Go or Python, partly due to its functional

side. The difficulty combined with its lack of popularity

would make it less likely to build a strong community

following. Scala runs on JVM, so it shares the same

downsides as Java in regards to the LXC compatibility,

in that it limits its portability. However, it shares the

benefits as well, such as being compatible with Java-

based tools like ant and Eclipse. It can also import from

Java classes, so it could borrow existing code and use

third party packages.

7 Conclusion Both Java and Scala suffer from the LXC compatibility

issue, while Python handles it easily. Python is also

already widely used and well documented, easy to learn,

and concise, which will encourage community involve-

ment. The performance would need to be investigated

further, but in my opinion it’s the best potential lan-

guage for DockAlt out of these three languages.

8 References [1] Docker website, https://www.docker.com/

[2] Docker GitHub, https://github.com/docker/docker

[3] Go website, https://golang.org/

[4] Linux Containers, https://linuxcontainers.org/

[5] Java entry on Wikipedia,

https://en.wikipedia.org/wiki/Java_(programming_langu

age)

[6] Python entry on Wikipedia,

https://en.wikipedia.org/wiki/Python_(programming_lan

guage)

[7] What is Scala?, http://www.scala-lang.org/what-is-

scala.html