Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Resque Laravel Package

david-garcia/php-resque

PHP port of GitHub’s Resque: a Redis-backed background job system for enqueueing and processing jobs with distributed workers. Supports multiple queues/priorities, forking for memory-leak resilience, job status tracking, failure marking, and setUp/tearDown hooks.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Background Job Processing: The package provides a Redis-backed job queue system, aligning well with Laravel’s need for async task processing (e.g., queues, commands, or event handling). It could replace Laravel’s native queue system (e.g., queue:work) if Redis is already in use.
  • Distributed Workers: Supports multi-machine worker distribution, which is critical for scaling Laravel applications with high job volumes.
  • Priority Queues: Matches Laravel’s queue priority system (e.g., queue:listen --queue=high,default), though implementation details (e.g., Redis key structure) must be validated.
  • Job Status Tracking: Offers built-in job status monitoring (success/failure), which could complement Laravel’s Job facade or Horizon monitoring.

Integration Feasibility

  • Redis Dependency: Requires Redis 2.2+, which is compatible with Laravel’s existing Redis support (e.g., predis or phpredis). No additional infrastructure changes needed if Redis is already deployed.
  • PHP 5.3+ Support: Laravel 8+ requires PHP 7.4+, so this is a blocker unless the fork is backported or a polyfill is used. Risk: High for modern Laravel apps.
  • Laravel Queue Contract Compatibility: The package does not natively implement Laravel’s Illuminate\Contracts\Queue\Job or Queue interfaces. Custom adapters would be required to integrate with Laravel’s queue system (e.g., Queue::push()).
  • Job Serialization: Laravel uses JSON serialization for jobs by default. This package may require adjustments to handle Laravel’s job payloads (e.g., closures, objects).

Technical Risk

  • Archived Status: Last release in 2017 with no activity. Risk of:
    • Undisclosed bugs in Laravel’s evolving ecosystem.
    • Incompatibility with modern PHP/Redis features (e.g., Redis 6+).
    • Lack of security patches (e.g., Redis protocol vulnerabilities).
  • Fork-Specific Changes: Minor adjustments may introduce hidden dependencies or breakages. Validation required against Laravel’s use cases.
  • No Web Interface: Laravel’s Horizon or queue:work --once relies on job visibility. This package lacks a native UI, requiring a custom solution (e.g., Redis CLI or third-party tools).
  • Forking Model: Uses pcntl_fork(), which may not work on all hosting environments (e.g., shared servers, Windows). Laravel’s queue workers (e.g., queue:work) default to process or sync for cross-platform compatibility.

Key Questions

  1. Compatibility:
    • Does the fork support Laravel’s job payload serialization (e.g., closures, Illuminate\Bus\Queueable)?
    • Are there known issues with Laravel’s ShouldQueue or Dispatchable traits?
  2. Performance:
    • How does job throughput compare to Laravel’s native queue system (e.g., database, redis)?
    • What is the memory/CPU overhead of pcntl_fork() vs. Laravel’s process driver?
  3. Maintenance:
    • Are there plans to update the fork for PHP 7.4+? If not, what’s the migration path?
    • How would failures (e.g., Redis downtime) be handled compared to Laravel’s retry logic?
  4. Monitoring:
    • Can Laravel’s Horizon or queue:failed table integrate with this package’s job status tracking?
    • Are there metrics (e.g., job duration, failures) exposed for APM tools?

Integration Approach

Stack Fit

  • Laravel Queue System: The package could replace Laravel’s Redis queue driver (redis) if:
    • The fork’s Redis key structure matches Laravel’s expectations (e.g., queues:*, failed:*).
    • Custom adapters bridge Laravel’s Queue facade to php-resque methods (e.g., Resque::enqueue()).
  • Alternatives:
    • Hybrid Approach: Use php-resque for high-priority queues and Laravel’s native queue for others.
    • Wrapper Library: Create a thin Laravel package to abstract php-resque behind Laravel’s queue interfaces.
  • Compatibility Matrix:
    Feature Laravel Native Queue php-resque Fork
    Job Serialization JSON ? (Investigate)
    Priority Queues Yes Yes
    Distributed Workers Yes Yes
    Delayed Jobs Yes ? (Check implementation)
    Retry Logic Yes ? (Manual handling?)

Migration Path

  1. Phase 1: Proof of Concept
    • Test job enqueuing/dequeuing with simple commands (e.g., Artisan::command).
    • Validate Redis key compatibility (e.g., queues:default vs. resque:queue).
  2. Phase 2: Adapter Layer
    • Build a Laravel service provider to override the Redis queue driver with php-resque.
    • Example:
      Queue::extend('resque', function ($app) {
          return new ResqueQueueService($app['redis']);
      });
      
  3. Phase 3: Feature Parity
    • Implement missing Laravel queue features (e.g., delayed jobs, job events).
    • Integrate with Laravel’s queue:failed table or a custom failure handler.
  4. Phase 4: Performance Testing
    • Benchmark against Laravel’s native Redis queue (e.g., queue:work --once).
    • Test failure scenarios (e.g., Redis timeouts, worker crashes).

Compatibility Considerations

  • Redis Configuration: Ensure Laravel’s config/queue.php Redis settings match php-resque expectations (e.g., connection pooling).
  • Worker Bootstrapping: Laravel’s queue:work relies on Laravel’s service container. php-resque may need custom initialization (e.g., Resque::setApp($app)).
  • Job Classes: Laravel jobs (e.g., App\Jobs\ProcessPodcast) must be compatible with php-resque’s execution model (e.g., __invoke() vs. handle()).

Sequencing

  1. Low-Risk Pilot: Start with non-critical jobs (e.g., logging, notifications).
  2. Monitoring: Implement custom logging for job statuses until Horizon integration is complete.
  3. Rollout: Gradually migrate queues, monitoring stability and performance.
  4. Fallback: Maintain Laravel’s native queue as a backup until confidence is high.

Operational Impact

Maintenance

  • Dependency Risks:
    • PHP 5.3+ Limitation: Requires polyfills or a fork update. Risk: High effort for minimal gain.
    • Redis Versioning: May need adjustments for Redis 6+ (e.g., new commands like CLIENT TRACKING).
  • Bug Fixes: No active maintenance means issues (e.g., memory leaks, Redis protocol changes) must be patched internally.
  • Documentation: Lack of up-to-date docs increases onboarding time for devs.

Support

  • Debugging Complexity:
    • Mixed stack traces (Laravel + php-resque) may obscure root causes.
    • No native web UI for job inspection (reliance on Redis CLI or custom tools).
  • Worker Management:
    • pcntl_fork() workers may behave differently than Laravel’s process driver (e.g., signal handling).
    • No built-in supervisor integration (e.g., Supervisor, Kubernetes). Requires custom scripts.
  • Error Handling:
    • Laravel’s queue:failed table may not sync with php-resque’s failure tracking. Custom logic needed.

Scaling

  • Horizontal Scaling: Supports distributed workers, but:
    • Locking mechanisms (e.g., Redis SETNX) must be validated for high concurrency.
    • No built-in circuit breakers for Redis failures (e.g., exponential backoff).
  • Vertical Scaling: Memory leaks (e.g., from pcntl_fork()) could require frequent worker restarts.
  • Redis Bottlenecks: Heavy job volumes may saturate Redis. Monitor:
    • Redis memory usage (maxmemory policy).
    • Latency in LPUSH/BRPOP operations.

Failure Modes

Failure Scenario Impact Mitigation Strategy
Redis Unavailable Jobs stuck in queue Fallback to database queue or local retries
Worker Crash Unprocessed jobs Supervisor auto-restart + dead-letter queue
PHP Memory Exhaustion Worker OOM kills Adjust memory_limit or use smaller workers
Forking Issues (pcntl) Workers silently die Switch to Laravel’s process driver
Job Serialization Errors Jobs fail silently Custom exception handling + logging

Ramp-Up

  • Developer Onboarding:
    • Training Needed: Devs must understand php-resque’s API (e.g
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor