Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Java Web Internals

You're reading from   Java Web Internals Unlock the secrets of Java web servers, frameworks, and application architecture

Arrow left icon
Product type Paperback
Published in Apr 2026
Publisher Packt
ISBN-13 9781835881484
Length 214 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Francisco Isidro Massetto Francisco Isidro Massetto
Author Profile Icon Francisco Isidro Massetto
Francisco Isidro Massetto
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Chapter 1: Networks, Protocols, and Packets 2. Chapter 2: Workings of a Web Server – A Case Study FREE CHAPTER 3. Chapter 3: Implementing a Simple Web Server 4. Chapter 4: Web Servers vs Application Servers 5. Chapter 5: Deep Dive into Simple Web Container Implementation 6. Chapter 6: Simple Web Container Improvements and Expansions 7. Chapter 7: Why Create a Web Framework 8. Chapter 8: Web Frameworks – The Necessary Abstraction for Professional Development 9. Chapter 9: Detailing the SimpleWebFramework Implementation 10. Chapter 10: The Emergence of Dependency Injection and Its Application in SimpleWebFramework 11. Chapter 11: Creating the First Application with SimpleWebFramework 12. Chapter 12: Unlock Your Exclusive Benefits 13. Other Books You May Enjoy 14. Index

Performance issues

Despite being simple and efficient, our SimpleWebServer application works in a single-threaded model; that is, it always serves one request at a time, failing to increase its performance. If there are 10 simultaneous requests, for example, our SimpleWebServer application will respond to them one by one sequentially.

This, in a real production environment, makes the adoption of a solution such as this unfeasible. But how can we improve the performance of a web server? One of the main solutions for this is to parallelize the processing of requests.

Java's Threads API can give us a remarkably interesting set of parallelism features. Let us imagine that, when accepting a connection, SimpleWebServer delegates its processing to a thread, as in the following diagram:

Image 8

Figure 3.8: SimpleWebServer threads

Each new thread receives the communication socket, handles the request, and generates a response. In our context, it needs to invoke the handleRequest method. The functioning...

lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Java Web Internals
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime
Modal Close icon
Modal Close icon