Course scalable IO in Java scalable network services

Extrait du course scalable IO in Java

Outline
-Scalable network services
-Event-driven processing
-Reactor pattern
Basic version
Multithreaded versions
Other variants
-Walkthrough of java.nio nonblocking IO APIs.
Network Services
-Web services, Distributed Objects, etc
-Most have same basic structure:
Read request
Decode request
Process service
Encode reply
Send reply
-But differ in nature and cost of each step
XML parsing, File transfer, Web page
generation, computational services, …
Classic ServerSocket Loop
class Server implements Runnable {
public void run() {
try {
ServerSocket ss = new ServerSocket(PORT);
while (!Thread.interrupted())
new Thread(new Handler(ss.accept())).start();
// or, single-threaded, or a thread pool
} catch (IOException ex) { /* … */ }
}
static class Handler implements Runnable {
final Socket socket;
Handler(Socket s) { socket = s; }
public void run() {
try {
byte[] input = new byte[MAX_INPUT];
socket.getInputStream().read(input);
byte[] output = process(input);
socket.getOutputStream().write(output);
} catch (IOException ex) { /* … */ }
}
private byte[] process(byte[] cmd) { /* … */ }
}
}
Note: most exception handling elided from code examples
Scalability Goals
-Graceful degradation under increasing load (more clients)
-Continuous improvement with increasing resources (CPU, memory, disk, bandwidth)
-Also meet availability and performance goals
Short latencies
Meeting peak demand
Tunable quality of service
-Divide-and-conquer is usually the best approach for achieving any scalability goal

…….

Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
Course scalable IO in Java scalable network services (599 KO) (Cours PDF)
Scalable IO in Java

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *