Weave 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

Laravel Shard Laravel Package

kefyusuf/laravel-shard

A Laravel package for database sharding, designed to distribute data across multiple database connections and simplify horizontal scaling. It offers shard-aware Eloquent models, query routing, and migration helpers, but has limited adoption and sparse documentation.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package occupies a high-blast-radius position in the stack: it mediates Redis shard selection for cache, queues, and Pulse metrics simultaneously. That is a platform-level dependency, not a leaf library — adoption is a shared-infrastructure decision, not a per-team one.
  • v5.0.1 is a patch release on a major version, so the architectural shape (DB-backed locator mapping + shard config object + rebalance tooling) is now the committed design. RedisShardConfig centralization suggests the configuration surface has stabilized after the v5.0.0 churn.
  • The package explicitly scopes itself as best-effort for cross-shard moves. That is an honest boundary, but it means the architecture assumes an operator-driven maintenance window rather than transparent elasticity. Teams expecting online resharding will be misaligned with the design.
  • Octane and queue-context handling in this release indicate the maintainers are targeting long-lived worker topologies, which is the right direction for modern Laravel deployments but also the hardest context to get right.

Integration feasibility

  • Integration is non-trivial but bounded: config object, locator mapping table, queue integration, and (optionally) Pulse. The queue-context fix matters most for multi-tenant systems where job routing depends on the locator — a silent fallback to captured affinity is a correctness bug, not a performance one, and it is now addressed.
  • The release removes the consumer-repository release dispatch workflow. This is an internal CI change, but it means release provenance/automation should be re-verified before pinning in regulated environments.
  • Documentation improvements (known limitations, retry risks, queue fallback behavior) materially reduce integration guesswork. This is the single biggest feasibility improvement in the release.

Technical risk

  • Highest risk: rebalance correctness under concurrency. The fixes for ambiguous key-to-row matches and fenced deletion with atomic snapshot predicates close real data-loss/loss-of-mapping paths, but they were regressions found in the field or in test — meaning v5.0.0 could produce orphaned or mis-deleted mapping rows. Anyone already on 5.0.0 should treat this as a required upgrade.
  • Second: environment parity. SQLite conditional deletion and unique-constraint caveats are documented, but test/local environments on SQLite will not exercise the production code path faithfully. Risk of "green locally, wrong in prod."
  • Third: schema and column-type coverage. Binary string comparison for case-insensitive columns is now handled, but the maintainers explicitly do not claim validation for every production database and column type. Column-collation edge cases remain an open class of risk.
  • Fourth: release quality signal. 276 tests / 725 assertions with one Laravel-version skip is reasonable but thin for a package touching shard relocation. Four regressions in a patch implies v5.0.0 validation was insufficient for the rebalance path.
  • Overall risk rating: medium-high for teams using rebalance; low-medium for teams using sharding statically without key movement.

Key questions

  1. What is the supported Laravel and PHP version matrix, and which Laravel version is the skipped test covering?
  2. Is there a v4 → v5 upgrade guide, and what are the breaking changes? The assessment cannot treat v5.0.1 as adoptable without that.
  3. How is the locator mapping persisted (table schema, index strategy), and what is the write-amplification cost per cache/queue operation?
  4. Is Redis Cluster supported, or only discrete standalone shards? This determines whether we can run it on managed Redis at all.
  5. What is the reconciliation story for rows retained by the new fencing logic — is there a CLI to list/count them, and what is the SLO for reconciling after a partial rebalance?
  6. Does the Pulse integration require a specific Pulse version, and does flushing shard counters affect existing dashboards?
  7. Who maintains this package (bus factor), and what is the release cadence and security disclosure process?

Integration Approach

Stack fit

  • Best fit: Laravel applications already running multiple Redis instances for isolation (tenant, region, workload) that need a single abstraction for cache/queue routing. Poor fit: single-Redis deployments (no benefit) and teams needing elastic, online resharding (out of scope by design).
  • Octane compatibility and CLI/queue/HTTP context flushing are prerequisites for our runtime; this release checks those boxes.

Migration path

  • Step 1: pin to v5.0.1 (not 5.0.0) and read the new known-limitations section before any code work.
  • Step 2: stand up the locator mapping in a non-production environment and validate against the production DB engine and column collations — not SQLite.
  • Step 3: migrate read paths first (cache), leave queues on captured affinity, then enable locator-driven queue routing once the keyed-context behavior is verified under retries and failures.
  • Step 4: enable Pulse shard counters last; it is observability, not a correctness dependency.
  • Step 5: treat rebalance as a separate, later project with an explicit change window — do not bundle it with initial adoption.

Compatibility

  • Requires confirmation of Laravel/PHP matrix and Redis topology support before commit. The one skipped Laravel-version test must be identified; if it is our target version, that is a blocker for the rebalance feature specifically.
  • Database engine and collation must be validated explicitly. SQLite must not be relied upon as a proxy for production behavior in CI for this package.

Sequencing

  • Weeks 1–2: compatibility spike, upgrade guide review, locator schema review.
  • Weeks 3–5: read-path integration in staging with production-equivalent DB and Redis.
  • Weeks 6–8: queue context validation, including retry and worker-restart scenarios under Octane.
  • Post-adoption: rebalance runbook, reconciliation tooling, and a documented quiesce procedure before any key movement.

Operational Impact

Maintenance

  • Low ongoing code footprint, but this is infrastructure-adjacent: version upgrades should be treated as platform changes with a review step, not routine composer update.
  • The v5.0.0 → v5.0.1 regression pattern argues for a soak period in staging on every minor/patch, particularly anything touching the rebalance command.

Support

  • Support burden concentrates in two places: rebalance operations (requires a named owner and a runbook) and mapping-table reconciliation after partial or failed moves.
  • Internal runbook must be authored before first production rebalance: quiesce writes, snapshot, move, verify retained rows, reconcile. The maintainers explicitly will not do this for us.

Scaling

  • Shard selection is a lookup — cheap — but the locator mapping is a hot dependency. Confirm caching and indexing of the mapping table under expected QPS before scaling traffic.
  • Rebalance cost scales with key count and shard count, and it is offline-by-implication. Growth planning must assume planned downtime windows or per-tenant maintenance windows, not live migration.

Failure modes

  • Ambiguous key matching (now rejected) — surfaces as a hard failure rather than silent corruption; acceptable.
  • Fenced deletion on a changed source row — row is retained and counted as fenced, requiring reconciliation; silent accumulation of retained rows is the most likely operational surprise.
  • Missing mapping or keyless job context — falls back to captured affinity, which is safe but can silently pin traffic to a deprecated shard.
  • Pulse counter flush across HTTP/queue/CLI/Octane — a missed context previously meant drifting metrics; now fixed, but dashboards should be re-baselined after upgrade.
  • Redis shard unavailability is not addressed by this release; existing failover behavior must be tested independently.

Ramp-up

  • Engineering: roughly one sprint for a mid-level Laravel engineer to integrate read paths; two to three sprints for the team to own rebalance confidently.
  • Operations/SRE: half a day of runbook training plus a supervised first rebalance.
  • Blast radius justifies an internal design review and an on-call note covering retained-row reconciliation before production enablement.
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.
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox