Slide 1 / 7 All pages

Cloud-Native Detection of Microservice Anti-Patterns

Using Static Analysis Tools and Serverless Architectures

Mahyad Mirzabagheri

MSc Software Engineering

Staffordshire University · September 2025

Supervisor: Dr Meriem Zouzou

View on GitHub

Research Gap & Problem Identification

No Cloud Integration

Analysis tools run on fixed infrastructure and don't use the automatic scaling and pay-per-use cost of serverless platforms

No Multi-Tool Orchestration

SonarQube, Roslyn and ArchUnit work separately, so results are duplicated, conflicting or incomplete

Limited Validation

Most studies test single tools on small proofs of concept, not several real projects

58+
Known microservice anti-patterns
20–40%
Lower cost with serverless (studies)
3
Research gaps addressed

Sources: Taibi, Lenarduzzi & Pahl (2020); Kumar et al. (2024); Anderson et al. (2023) — see dissertation Chapter 2

Proposed Solution: Serverless Architecture

Designed for AWS (Lambda, EventBridge, S3, RDS) · prototype simulated with Docker Compose

Event Layer

API / CI/CD triggers

Orchestration

Lambda-style containers

Analysis

Tool concepts run

Integration

Normalise & merge

Reporting

Dashboard & API

Python
Docker
FastAPI
PostgreSQL
Redis
MinIO

Multi-Tool Integration Strategy

SonarQube

Code quality & smells → coupling, granularity

Roslyn

.NET/C# → service intimacy, idempotency

ArchUnit

Java architecture → dependencies, layers, cycles

Location Matching

Same file & line = strongest match (score 1.0); nearby lines score lower

Pattern Type

Findings of the same anti-pattern type are linked

Semantic Similarity ↗

TF-IDF + cosine similarity on issue descriptions (click for example)

Resolution Rules

Higher confidence wins · tool expertise · critical first · unclear → human review

Implementation

Docker Simulation

FastAPI API
≈ API Gateway + Lambda
PostgreSQL
≈ Amazon RDS
MinIO
≈ Amazon S3
Redis
≈ ElastiCache
SonarQube · Roslyn · ArchUnit
tool containers
Dashboard
HTML/JS via Nginx

Patterns Detected (examples)

Hardcoded Connection Hardcoded Endpoints Synchronous Blocking Shared Persistence Distributed Monolith Cyclic Dependencies Missing API Gateway Service Intimacy Missing Idempotency

Real analysis of source code (e.g. connection strings, Thread.sleep, shared databases, imports), not pre-set results.

See the dashboard & API running →

Validation Results

Preliminary validation: 2 files, 6 known anti-patterns → 4 found, 0 false alarms

100%
Precision
66.7%
Recall
80%
F1-Score

Anti-patterns detected per project (analysis time)

2
gs-spring-boot
15 files · ~5 s
4
petclinic
42 files · ~15 s
5
sock-shop
38 files · ~20 s
6
eShopOnContainers
67 files · ~35 s

Validation Summary & Conclusions

Validation Results

  • Tested on 4 real projects (15-67 files)
  • 100% precision achieved (0 false positives)
  • 66.7% recall (4/6 patterns detected)
  • Time grew roughly linearly with size (~5 s → ~35 s)
  • 2–6 patterns detected per project

Key Contributions

  • New cloud-native multi-tool architecture
  • Docker simulation of AWS serverless (proof of concept)
  • Normalisation + conflict-resolution design
  • ~£0.04 per analysis (projected AWS cost)
  • Open source on GitHub

Limitations

• Small validation set (2 files, 6 patterns)
• Docker simulation, not real AWS Lambda
• Simplified tool concepts, not full tool APIs

Future Work

• Deploy to real AWS Lambda
• Full SonarQube/Roslyn/ArchUnit API integration
• Machine learning & more languages (Go, Python)

Architecture demo → One-page summary →
Use ← → arrow keys, the buttons, or swipe