SkillAgentSearch skills...

DistributedComputingExamples

Example codes for my Distributed Computing course at Hefei University.

Install / Use

/learn @thomasWeise/DistributedComputingExamples

README

Examples for Distributed Computing

<img alt="Travis CI Build Status" src="https://img.shields.io/travis/thomasWeise/distributedComputingExamples/master.svg" height="20"/> <img alt="Shippable Build Status" src="https://img.shields.io/shippable/56d905429d043da07b368422.svg" height="20"/>

1. Introduction and Contents

1.1. Introduction

Distributed systems surround us everywhere today. Their most prominent example is the internet hosting the world wide web. The computing environment in enterprise computing systems is often distributed too, interconnecting different services from human resources, financial departments, to asset management systems. Many applications are even hosted in the cloud. Finally, large-scale engineering and scientific computing today rely heavily on clusters in order to parallelize their workload. These topics are discussed in my distributed computing lecture. In this repository, you can find the practical examples I use in my course.

1.2. Contents

  1. Sockets

  2. in C

  3. in Java

  4. HTML, CSS, and JavaScript

  5. Java Servlets

  6. deployable examples

  7. HTTP Proxy Servlet

  8. JavaServer Pages

  9. deployable examples

  10. stand-alone JSPs

  11. Java RMI

  12. XML

  13. examples for XML documents and related standards

  14. examples for XML processing with Java

  15. Web Services

  16. JSON RPC

  17. Message Passing Interface

  18. Hadoop

Each of the above links leads you to a sub-directory containing a set of examples. Each sub-directory has an own README.md file with detailed descriptions.

Since I also use the same code in my slides, there are some special comments such as //(*@\serverBox{2)}@*) for formatting in my codes ... you can safely ignore them ^_^

2. Concept of the Course

The concept of this course is that we want to understand how the web and distributed enterprise application environments work. We want to do that by starting to explore how to communicate over a network at the lowest level of abstraction (normally) available to programmers, the socket API. From there, we work our way up step-by-step higher levels of abstraction, i.e., simpler and more powerful API stacking on top of each other (and ultimately grounded in sockets). This way, we will gain a solid understanding how distributed applications and the web work. We will be able to look at a website and immediately have a rough understanding of how it may work, down to the nuts and bolts. For each level of abstraction that we explore, we therefore always learn example technologies.

2.1. The Basics: Sockets, TCP, UDP, Parallelism, and Mashalling

As said, we start at the very bottom: Communication in distributed systems today is usually either based on the UDP or TCP. Both protocols are accessed via the socket API, for which we provide examples in both C and Java. As part of these examples, we also show how text can be encoded in Java and how to construct servers which can process multiple requests in parallel. Sockets are thus the very basis of distributed applications, the lowest level with which a programmer might have to work.

2.2. The Outside View of an Enterprise: Dynamic Websites

We now are able to understand the basic communication processes going on in virtually any current computer network and the internet. We will use this understand to investigate how an organization or enterprise can present itself to the outside world via a website. We want to understand the technologies necessary to construct a website that can dynamically interact with a user.

2.2.1. HTML, CSS, JavaScript

The world wide web is based on three pillars: HTTP, HTML/CSS/Javascript, and URLs. HTTP, the Hyper Text Transfer Protocol, is a text-based protocol to query resources which is usually transmitted over TCP connections. Actually, we already provide example implementations of both the server (web server) and client (web browser) client side of the HTTP communication using sockets (and even a small parallel web server. We then provide some rudimentary examples for HTML, CSS, and JavaScript.

2.2.2. Java Servlets: HTTP Protocol Server-Side Implementation

Implementing HTTP based on sockets is quite complex. Sockets allow us access TCP. What we would like to have is a similarly elegant API to access HTTP (the next higher level of abstraction). One such technology are Java Servlets. Servlets are used to implement the server-side of a HTTP conversation. A servlet is a sub-class of a special Java class which implements handler methods for different HTTP interactions ("HTTP methods"). These methods are called by a servlet container, the actual implementation of the server. We can therefore fully concentrate on the application logic and don't need to worry about the protocol interaction itself. We provide a wide range of examples for Java Servlets, both deployable examples as well as a stand-alone HTTP Proxy Servlet. So with Java Servlets, we can build server components that can dynamically interact with a HTTP client (such as a web browser). This means that we can dynamically generate contents of a web page when a browser requests them. However, building complete dynamic web sites as Java Servlets is again quite cumbersome, as servlets are Java classes while web pages are HTML, which we would then write in form of string constants to be written to the output of a Servlet.

2.2.3. JavaServer Pages: Implement Dynamic Web Pages

The next higher level of abstraction are JavaServer Pages (JSPs), which allow us to write HTML pages (or other text formats) and include Java source code in it. The pages are then served again by a servlet container. Whenever a page is sent to a client, the included Java code is first executed on the server side (and may generate additional output). Upon closer inspection, we can find that JSPs are actually "special" servlets: When a JSP is accessed for the first time, the servlet container dynamically creates the source code of

View on GitHub
GitHub Stars71
CategoryDevelopment
Updated1mo ago
Forks31

Languages

Java

Security Score

85/100

Audited on Feb 13, 2026

No findings