A multithreaded proxy web server built entirely in pure C, designed for performance, modularity, and scalability. Supports HTTP/HTTPS requests, caching with LRU strategy, site blocking, and high concurrency handling.
-
Multithreaded Proxy Server – Handles multiple client connections concurrently using a thread pool.
-
Custom Fetch Utility (C-based) – Fetches remote websites without external libraries, mimicking
fetchbehavior. -
HTTP Parser – Minimal and custom-built parser tailored to proxy needs.
-
LRU-based Cache Strategy
- In-Memory (Linked List) for quick lookups.
- Disk-based Storage + Persistence for large resources.
- Cache Invalidation logic for expired/blocked entries.
-
Site Blocking – Reads
blocked_sites.jsonto deny access to restricted domains. -
SSL/TLS Support – Wraps TCP sockets with SSL for HTTPS connections.
-
Dynamic Memory Allocation – Efficient fetching of large websites.
-
Modular Code Structure – Each component (parsing, caching, networking, SSL, thread pool) is an independent module.
-
🐳 Dockerized for easy setup, deployment, and portability.
┌───────────────────┐
Client Request →│ ProxyRaQ Listener │─┐
└───────────────────┘ │
│ │
▼ │
┌───────────────┐ │
│ Thread Pool │ │
└───────────────┘ │
│ │
┌───────────────┐ ┌──────────────┐ │
│ HTTP Parser │ │ Site Blocker │ │
└───────────────┘ └──────────────┘ │
│ │
▼ │
┌───────────────────────────────┐
│ Cache (LRU + Disk Persistence) │
└───────────────────────────────┘
│
▼
┌──────────────────┐
│ Remote Web Server │
└──────────────────┘
- Client → ProxyRaQ → Remote Server → ProxyRaQ → Client
- Handles requests concurrently using a thread pool.
- Stores responses in LRU cache (RAM + disk) for faster future lookups.
- Filters requests if they match entries in the blocked sites list.
- Supports both HTTP & HTTPS traffic.
The proxy was tested locally using ApacheBench (ab) on a 4-core CPU. We measured throughput and latency with different concurrency levels.
| Clients (Concurrency) | Requests | Requests/sec | Mean Latency | Longest Request | Failures |
|---|---|---|---|---|---|
| 100 | 10,000 | ~2261 req/s | ~44 ms | 876 ms | 0 |
| 1000 | 10,000 | ~2172 req/s | ~460 ms | 890 ms | 0 |
✅ Even under 1000 concurrent clients, ProxyRaQ handled all 10k requests without failure. ⚙️ Increasing backlog size from 10 → 1024 was essential to support high concurrency.
(1000 concurrent clients, 10k requests, no failures)
- Raising the socket backlog (
listen(fd, backlog)) from10→1024improved stability under load. - The proxy maintains consistent throughput (~2k req/s) even at 10× concurrency.
- Latency scales linearly with concurrency, as expected due to queuing + thread pool scheduling.
- No failed requests in either scenario, demonstrating robust handling.
ProxyRaQ is fully Dockerized for easy deployment.
docker build -t proxyraq .docker run -p 4040:4040 proxyraqNow the proxy server will be running at:
👉 http://localhost:4040/?url=https://example.com
git clone https://github.com/yourusername/proxyraq.git
cd proxyraqmakePORT=4040 ./serverab -n 10000 -c 100 "http://localhost:4040/?url=https://wikipedia.org"proxyraq/
├── src/
│ ├── main.c
│ ├── http_parser.c
│ ├── cache.c
│ ├── thread_pool.c
│ ├── ssl_wrapper.c
│ └── site_blocker.c
├── include/
│ ├── http_parser.h
│ ├── cache.h
│ ├── thread_pool.h
│ ├── ssl_wrapper.h
│ └── site_blocker.h
├── blocked_sites.json
├── Makefile
├── Dockerfile
└── README.md
- 📊 Add monitoring & metrics dashboard.
- 🧵 Support for asynchronous I/O (epoll-based).
- 📂 Smarter cache eviction strategies.
- 🔐 Better TLS certificate management.