Skip to content

Latest commit

 

History

History
282 lines (220 loc) · 10.7 KB

File metadata and controls

282 lines (220 loc) · 10.7 KB

JCRON Go Port'u ve SQL-Ports Arasındaki Farklar ve Eksiklikler

Giriş

JCRON projesi, yüksek performanslı cron scheduling için birden fazla implementasyon içerir. Bu dokümanda, Go port'u (ana Go kü## ✅ Syntax Compatibility Analizi (Sonraki İnceleme)

Ayrıntılı İnceleme: Bkz. syntax_compatibility_check.md

Syntax Uyum Özeti

  • Basic Cron: 100% uyumlu (5, 6, 7-field)
  • Advanced Patterns: 100% uyumlu (L, #, W syntax)
  • EOD/SOD Modifiers: 100% uyumlu
  • Extensions: 95% uyumlu (WOY, TZ - minor UTC offset eksik)
  • Multi-Pattern (|): ❌ Go'da YOK
  • Overall: 88% uyumlu

Kritik Syntax Eksiklikleri Go'da

  1. Multi-Pattern Operator (|) - PostgreSQL'de çalışır, Go'da değil
  2. UTC Offset Timezone (TZ:+03:00) - Go sadece IANA names destekler

Sonuç ve Öneriler

Özet

Go port'u, tam-featured, production-ready bir scheduling library iken, SQL-ports temel zaman hesaplama fonksiyonlarına odaklanır.

Syntax açısından: Go ve SQL-ports'ta 88% uyumluluk var. Kritik eksiklik Go'da multi-pattern support'u.

Execution açısından: En kritik eksiklik, SQL-ports'ta job execution engine'inin olmamasıdır.

Kritik Aksiyon Önerileri

🔴 SQL-Ports İçin (Execution)

  1. Job execution wrapper'larını ekle (scheduler guide'ı expand et)
  2. Error handling - retry ve error reporting ekle
  3. Monitoring - execution logs ve metrics ekle

🔴 Go Port İçin (Syntax)

  1. Multi-Pattern Support - Pipe operator (|) desteği ekle
  2. UTC Offset Timezone - TZ:+03:00 format parsing ekle

🟡 Her İki Port İçin

  1. Hybrid Integration - Go ve SQL port'ları arasında seamless integration
  2. Wrapper Functions - next_end(), prev_start(), get_duration() consistency
  3. Documentation - Compatibility matrix açık hale getir

Development Priority

High Priority

  • Multi-Pattern Support (Go) - Syntax completeness için gerekli
  • Job execution engine (SQL) - Scheduling functionality için gerekli

Medium Priority

  • UTC Offset TZ (Go) - Timezone flexibility
  • Error handling (SQL) - Robustness
  • Wrapper functions - Developer experience

Low Priority

  • WOY Multi-year edge cases - Advanced scenarios
  • Additional helper functions - Enhancement

Bu karşılaştırma, hangi port'un hangi use case için uygun olduğunu belirlemek için temel referans olarak kullanılabilir.


Son Güncelleme: 24 Ekim 2025
Uyum Durumu: 88% (Syntax), 50% (Execution)
Referans: syntax_compatibility_check.md, missing_features_go_port.md-ports (PostgreSQL SQL fonksiyonları) arasındaki temel farklar, özellik karşılaştırması ve kritik eksiklikler detaylıca incelenmiştir.

Tarih: 24 Ekim 2025
Versiyon: Go Port v4.2.0, SQL-Ports v4.0

Go Port Özellikleri Özeti

Go port'u, tam teşekküllü bir Go kütüphanesi olarak tasarlanmıştır:

Temel Bileşenler

  • Engine: Cron expression parsing ve zaman hesaplaması
  • Runner: Job execution engine (start/stop, concurrency control)
  • Job Management: Add/remove jobs, retry policies, panic recovery
  • Schedule Struct: Detaylı scheduling konfigürasyonu

Performans Özellikleri

  • Core operations: 152-289ns
  • Zero-allocation hot paths
  • Sub-nanosecond bit operations (0.3ns)
  • Aggressive caching with RWMutex

Desteklenen Özellikler

  • ✅ 5-field ve 6-field cron syntax
  • ✅ Advanced patterns: L (last), # (nth), W (weekday)
  • ✅ Week of Year (WOY) support
  • ✅ Timezone support (IANA zones)
  • ✅ EOD/SOD modifiers (End/Start of Day/Week/Month/Hour)
  • ✅ Thread-safe concurrent operations
  • ✅ Built-in error handling & retries
  • ✅ Panic recovery
  • ✅ Structured logging (slog integration)
  • ✅ PostgreSQL integration
  • ✅ Job execution with configurable options

API Yapısı

type Schedule struct {
    Second, Minute, Hour, DayOfMonth, Month, DayOfWeek, Year, WeekOfYear, Timezone *string
}

type Runner struct {
    // Job management, execution control
}

func (e *Engine) NextTime(schedule Schedule, from time.Time) (time.Time, error)
func (r *Runner) AddFuncCron(pattern string, fn func() error) (*Job, error)

SQL-Ports Özellikleri Özeti

SQL-ports, PostgreSQL için saf SQL fonksiyonları olarak implement edilmiştir:

Temel Bileşenler

  • Core Functions: next_time, match_time, prev_time
  • Helper Functions: Timezone conversion, pattern validation
  • Scheduler Guide: Manuel job table ve execution logic

Performans Özellikleri

  • 10,000+ patterns/second throughput
  • Sub-0.1ms average latency
  • Optimized for PostgreSQL query execution

Desteklenen Özellikler

  • ✅ Full cron syntax (6-field)
  • ✅ Advanced patterns: L, #, W
  • ✅ Week of Year (WOY) support
  • ✅ Timezone support
  • ✅ EOD/SOD modifiers (E/S + D/W/M/H)
  • ✅ Pattern validation
  • ✅ Batch processing support

API Yapısı

-- Core functions
jcron.next_time(pattern TEXT, from_time TIMESTAMPTZ DEFAULT NOW()) RETURNS TIMESTAMPTZ
jcron.match_time(pattern TEXT, check_time TIMESTAMPTZ) RETURNS BOOLEAN
jcron.prev_time(pattern TEXT, from_time TIMESTAMPTZ) RETURNS TIMESTAMPTZ

-- Helper functions
jcron.get_duration(pattern TEXT, from_time TIMESTAMPTZ) RETURNS INTERVAL
jcron.next_end(pattern TEXT) RETURNS TIMESTAMPTZ
jcron.prev_start(pattern TEXT) RETURNS TIMESTAMPTZ

Temel Farklar

1. Mimari Farklar

Özellik Go Port SQL-Ports
Execution Model In-memory Go runtime PostgreSQL database functions
Job Execution Built-in runner with goroutines Manual implementation required
Concurrency Go goroutines + channels PostgreSQL connection pooling
Persistence Optional PostgreSQL integration Native database storage
Language Go application code SQL queries/stored procedures

2. Özellik Kapsamı

Özellik Go Port SQL-Ports
Cron Syntax Support ✅ Full ✅ Full
Advanced Patterns (L, #, W)
Week of Year (WOY)
Timezone Support ✅ IANA zones ✅ IANA zones
EOD/SOD Modifiers ✅ D/W/M/H ✅ D/W/M/H
Job Scheduling ✅ Built-in ❌ Manual
Retry Policies ✅ Configurable ❌ None
Error Handling ✅ Panic recovery ❌ Basic
Logging ✅ Structured ❌ None
Monitoring ✅ Built-in metrics ❌ Manual

3. Performans Farkları

Metrik Go Port SQL-Ports
Single Operation 152-289ns ~0.092ms
Throughput High (in-memory) 10,861 patterns/sec
Memory Usage Low (Go heap) Database memory
Scaling Vertical (Go app) Horizontal (PostgreSQL cluster)

Kritik Eksiklikler ve Açıklar

🚨 Kritik Eksiklikler (SQL-Ports'ta Yok)

  1. Built-in Job Execution Engine

    • Eksiklik: SQL-ports'ta job execution için runner yok. Manuel implementation gerekli.
    • Etki: Production-ready scheduler için ek development needed.
    • Go'da Mevcut: Runner.Start(), AddFuncCron(), automatic execution.
  2. Retry ve Error Handling

    • Eksiklik: SQL fonksiyonları error handling yapmaz, retry logic yok.
    • Etki: Failed jobs için recovery mechanism eksik.
    • Go'da Mevcut: Configurable retry policies, panic recovery.
  3. Concurrent Job Execution Control

    • Eksiklik: Multiple jobs aynı anda çalıştırılamaz, concurrency control yok.
    • Etki: High-load scenarios'da bottleneck.
    • Go'da Mevcut: Goroutine-based execution with limits.
  4. Structured Logging ve Monitoring

    • Eksiklik: Execution logs, metrics, health checks yok.
    • Etki: Debugging ve monitoring zor.
    • Go'da Mevcut: slog integration, execution statistics.
  5. Real-time Job Management

    • Eksiklik: Add/remove jobs runtime'da yapılamaz.
    • Etki: Dynamic scheduling için limitation.
    • Go'da Mevcut: AddJob(), RemoveJob() methods.

⚠️ Önemli Farklar (Farklı Implementasyon)

  1. Timezone Handling

    • Go: Compile-time IANA validation
    • SQL: Runtime PostgreSQL timezone conversion
    • Fark: SQL'de daha flexible, ama error-prone
  2. WOY Edge Cases

    • Go: Robust handling of week/year conflicts
    • SQL: 2.7% error rate in complex WOY patterns
    • Fark: Go daha reliable, SQL'de edge case issues
  3. Memory vs Database Trade-offs

    • Go: In-memory caching, fast access
    • SQL: Database queries, network latency
    • Fark: Go low-latency, SQL high-throughput

📊 Özellik Karşılaştırma Matrisi

Feature Category Go Port Score SQL-Ports Score Notes
Cron Syntax 10/10 10/10 Both full support
Performance 10/10 9/10 Go faster single ops, SQL better throughput
Advanced Patterns 10/10 9/10 SQL has WOY edge cases
Job Execution 10/10 2/10 Critical gap
Error Handling 9/10 3/10 Critical gap
Concurrency 10/10 4/10 Critical gap
Monitoring 8/10 1/10 Critical gap
Ease of Use 9/10 6/10 Go more developer-friendly
Production Ready 10/10 5/10 SQL needs more infrastructure

Kullanım Senaryoları ve Tavsiyeler

Go Port'u Tercih Et:

  • Microservices architectures (Go uygulamaları)
  • Real-time job scheduling (low latency needed)
  • Complex retry/error handling required
  • In-memory performance critical
  • Go ecosystem integration

SQL-Ports'u Tercih Et:

  • Database-centric applications
  • Batch processing workloads
  • High-throughput scenarios
  • Existing PostgreSQL infrastructure
  • SQL-based scheduling logic

Hybrid Approach:

  • Go port for job execution
  • SQL-ports for complex time calculations
  • PostgreSQL for persistence

Sonuç ve Öneriler

Özet

Go port'u, tam-featured, production-ready bir scheduling library iken, SQL-ports temel zaman hesaplama fonksiyonlarına odaklanır. En kritik eksiklik, SQL-ports'ta job execution engine'inin olmamasıdır.

Kritik Aksiyon Önerileri

  1. SQL-Ports Enhancement: Job execution wrapper'ları ekle (scheduler guide'ı expand et)
  2. Error Handling: SQL fonksiyonlarına retry ve error reporting ekle
  3. Monitoring: Execution logs ve metrics ekle
  4. Hybrid Integration: Go ve SQL port'ları arasında seamless integration

Development Priority

  • High Priority: Job execution engine for SQL-ports
  • Medium Priority: Error handling improvements
  • Low Priority: Additional helper functions

Bu karşılaştırma, hangi port'un hangi use case için uygun olduğunu belirlemek için temel referans olarak kullanılabilir. /Users/mapletechnologies/go-workspace/src/github.com/meftunca/jcron/differences_go_vs_sql.md