Skip to content

kelgel/springboot-scalable-article-hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“° Scalable Article Hub

A scalable backend system for managing and serving large volumes of articles.
This project aims to explore high-performance backend architecture using Spring Boot, JPA, and JWT-based authentication.


πŸš€ Project Status – Week 1 βœ…

  • βœ… User & Post entity design (JPA)
  • βœ… Basic CRUD for User and Post
  • βœ… JWT-based authentication implemented
  • βœ… Swagger (OpenAPI) documentation integrated
  • βœ… Postman API testing completed
  • βœ… @Transactional issue resolved and documented

πŸš€ Project Status – Week 2 βœ…

  • βœ… Large Dataset Generation & Insertion

    • Generated 10,000+ articles using Faker and inserted them into MySQL
    • Indexed all records into Elasticsearch for search performance testing
  • βœ… Search API Implementation

    • MySQL Search: JPA with findByTitleContainingOrContentContaining + pagination & sorting
    • Elasticsearch Search: Java API Client with MultiMatchQuery (title, content) + author/date filters
  • βœ… Performance Testing with Postman

    • Designed 5 test scenarios changing keyword, page, and size parameters
    • Measured response time for both MySQL and Elasticsearch
  • βœ… Performance Comparison Results

    Request No. MySQL Time (ms) Elasticsearch Time (ms)
    1 (keyword=love) 193 37
    2 (keyword=kill) 186 31
    3 (keyword=story) 143 25
    4 (page=1) 104 25
    5 (size=5) 137 26
    Average 152.6 28.8

    βœ… Conclusion: Elasticsearch achieved ~5x faster average response times compared to MySQL.

πŸš€ Project Status – Week 3 βœ…

  • βœ… Redis Caching Integration

    • Redis container launched via docker-compose
    • Integrated Redis into Spring Boot for view count caching
    • Implemented scheduler to periodically flush cached deltas back to MySQL
  • βœ… Cache Performance Testing (JMeter)

    • Designed tests with 100 concurrent users and different access patterns:
      • Hot (few popular articles repeatedly requested)
      • Random (uniform random requests)
      • Zipf (realistic skewed distribution)
      • Cold (no cache preloaded) vs Warm (cache preloaded)
  • βœ… Cache Hit/Miss Results

    Scenario Cold (Hits/Misses) Warm (Hits/Misses)
    Hot 0 / 100 99 / 1
    Random 0 / 100 50 / 50
    Zipf 50 / 50 91 / 9

    βœ… Insights

    • Caching is most effective under Hot access pattern (~99% hit ratio).
    • Zipf distribution also benefits strongly from caching.
    • Random distribution shows limited caching gains, as expected.
  • βœ… Visualization

    Cache Hit Ratio

    (Cache hit ratios for Hot, Random, Zipf under Cold vs Warm conditions)


πŸ›  Tech Stack

Layer Tech Used
Backend Spring Boot, Spring Security
Database MySQL (JPA, Hibernate), Elasticsearch 8.x
Auth JWT (access token only)
Docs/Test Swagger (springdoc), Postman
Build Tool Maven

πŸ“‚ Current Structure

src/
└── main/
    β”œβ”€β”€ java/com/euni/articlehub/
    β”‚   β”œβ”€β”€ controller/
    β”‚   β”œβ”€β”€ service/
    β”‚   β”œβ”€β”€ repository/
    β”‚   β”œβ”€β”€ document/          # Elasticsearch documents
    β”‚   β”œβ”€β”€ dto/
    β”‚   β”œβ”€β”€ entity/
    β”‚   β”œβ”€β”€ filter/
    β”‚   └── util/
    └── resources/
        β”œβ”€β”€ application.yml
        └── static/templates (future)    

βš™οΈ How to Run

# Clone the project
git clone https://github.com/your-username/scalable-article-hub.git

# Navigate into the project
cd scalable-article-hub

# Run the Spring Boot application
./mvnw spring-boot:run
Swagger UI available at:

πŸ‘‰ http://localhost:8080/swagger-ui/index.html

Kibana (Elasticsearch monitoring) available at:

πŸ‘‰ http://localhost:5601

Redis (default port):

πŸ‘‰ redis://localhost:6379

RedisInsight (Redis GUI):

πŸ‘‰ http://localhost:5540

πŸ’Ό About This Project

This project is part of my backend engineering portfolio, aimed at demonstrating:

  • Scalable API development with Java & Spring Boot

  • Performance optimization using Elasticsearch

  • Secure architecture with JWT authentication

  • Practical API testing using Postman

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages