Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/test-pecl-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ runs:

- name: Determine package info
shell: bash
id: package-info
env:
SKIP_CREATION: ${{ inputs.skip-package-creation }}
PACKAGE_PATH: ${{ inputs.package-path }}
Expand Down Expand Up @@ -95,14 +96,25 @@ runs:
echo "Package directory: $PACKAGE_DIR"
echo "Version: $VERSION"

# Check if version contains 'rc' (case-insensitive)
if echo "$VERSION" | grep -qi "rc"; then
echo "is-rc=true" >> $GITHUB_OUTPUT
echo "Release candidate detected - PECL installation test will be skipped"
else
echo "is-rc=false" >> $GITHUB_OUTPUT
echo "✓ Stable version detected - PECL installation test will run"
fi

- name: Setup PHP
if: steps.package-info.outputs.is-rc != 'true'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
extensions: tokenizer, json, ctype, iconv, mbstring
tools: none

- name: Install system dependencies
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
env:
PHP_VER: ${{ inputs.php-version }}
Expand All @@ -124,6 +136,7 @@ runs:
libprotobuf-c1

- name: Install shared dependencies
if: steps.package-info.outputs.is-rc != 'true'
uses: ./.github/workflows/install-shared-dependencies
with:
os: ubuntu
Expand All @@ -132,6 +145,7 @@ runs:
github-token: ${{ inputs.github-token || github.token }}

- name: Install cbindgen
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
run: |
if [ -f "$HOME/.cargo/bin/cbindgen" ]; then
Expand All @@ -142,6 +156,7 @@ runs:
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Setup sccache for cross-user Rust caching
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
run: |
echo "=== Setting up sccache for cross-user Rust compilation caching ==="
Expand All @@ -167,6 +182,7 @@ runs:
echo "sccache setup complete"

- name: Setup Cargo cache for root user
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
run: |
echo "=== Setting up Cargo cache for root user ==="
Expand Down Expand Up @@ -205,6 +221,7 @@ runs:
echo "Shared compilation cache setup complete"

- name: Test PECL installation
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
run: |
echo "=== Testing PECL-style installation ==="
Expand Down Expand Up @@ -344,6 +361,7 @@ runs:
fi

- name: Verify PECL installation
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
run: |
echo "=== Checking PHP extension directory ==="
Expand All @@ -363,13 +381,15 @@ runs:
php -d extension=valkey_glide -r "if (extension_loaded('valkey_glide')) { echo 'SUCCESS: Extension loaded and functional!'; } else { echo 'ERROR: Extension not functional'; }"

- name: Install PHP dependencies
if: steps.package-info.outputs.is-rc != 'true'
shell: bash
run: |
echo "=== Installing PHP dependencies ==="
composer install --no-interaction --prefer-dist --optimize-autoloader
echo "Composer install completed"

- name: Run PHP Extension Tests
if: steps.package-info.outputs.is-rc != 'true'
uses: ./.github/workflows/run-php-tests
with:
extension-path: valkey_glide
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/validate-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ runs:
echo ""
echo "=== Validating package.xml versions ==="

# Skip validation for release candidate versions
if [[ "$EXPECTED_VERSION" == *"rc"* ]]; then
echo "SKIPPED: Version contains 'rc' (release candidate) - package.xml validation skipped"
echo "Release candidate versions are not published to PECL"
exit 0
fi

# Extract release version from package.xml (first occurrence only - main version, not changelog)
RELEASE_VERSION=$(grep -o '<release>[^<]*</release>' package.xml | head -1 | sed 's/<[^>]*>//g')
echo "Release version in package.xml: $RELEASE_VERSION"
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# Changelog

## 1.0.0

### Changes (1.0.0)

* PHP: Fix mac development instructions ([#96](https://github.com/valkey-io/valkey-glide-php/pull/96))
* PHP: chore: bump valkey-glide submodule for root_certs support ([#99](https://github.com/valkey-io/valkey-glide-php/pull/99))
* PHP: ci: Add release automation workflows and version management ([#94](https://github.com/valkey-io/valkey-glide-php/pull/94))
* PHP: (dev): Update and improve linting infrastructure ([#104](https://github.com/valkey-io/valkey-glide-php/pull/104))
* PHP: (ci): test-modules job queuing indefinitely ([#106](https://github.com/valkey-io/valkey-glide-php/pull/106))
* PHP: (feat): Add TLS support for secure connections ([#100](https://github.com/valkey-io/valkey-glide-php/pull/100))
* PHP: feat: add markdown linting support for developers ([#110](https://github.com/valkey-io/valkey-glide-php/pull/110))
* PHP: perf(php): optimize struct member ordering to reduce padding ([#111](https://github.com/valkey-io/valkey-glide-php/pull/111))
* PHP: Add script and function commands ([#97](https://github.com/valkey-io/valkey-glide-php/pull/97))
* PHP: Pub/Sub Implementation ([#121](https://github.com/valkey-io/valkey-glide-php/pull/121))
* PHP: Remove ValkeyGlideClusterException ([#127](https://github.com/valkey-io/valkey-glide-php/pull/127))
* PHP: Add aliases to PHPRedis-compatible class names ([#126](https://github.com/valkey-io/valkey-glide-php/pull/126))
* PHP: Add connect method for ValkeyGlide client ([#131](https://github.com/valkey-io/valkey-glide-php/pull/131))
* PHP: Add benchmarks ([#124](https://github.com/valkey-io/valkey-glide-php/pull/124))
* PHP: Fix validation check for rc builds on PECL Package ([#135](https://github.com/valkey-io/valkey-glide-php/pull/135))

## 0.10.0

### Changes
### Changes (0.10.0)

* PHP: Implement TLS support for PHP client ([#2983](https://github.com/valkey-io/valkey-glide/pull/2983))
* PHP: Add refresh topology configuration
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ For easier migration from PHPRedis, you can use PHPRedis-compatible class names:
**Standalone:**

```php
// Load the PHPRedis compatibility aliases
require_once 'vendor/valkey-io/valkey-glide-php/phpredis_aliases.php';
// Register PHPRedis compatibility aliases
ValkeyGlide::registerPHPRedisAliases();

// Now you can use Redis instead of ValkeyGlide
$client = new Redis();
Expand All @@ -291,8 +291,8 @@ $client->close();
**Cluster:**

```php
// Load the PHPRedis compatibility aliases
require_once 'vendor/valkey-io/valkey-glide-php/phpredis_aliases.php';
// Register PHPRedis compatibility aliases
ValkeyGlide::registerPHPRedisAliases();

// Now you can use RedisCluster instead of ValkeyGlideCluster
$cluster = new RedisCluster(
Expand Down
11 changes: 8 additions & 3 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,45 @@ php run.php
### Examples

**Standalone server:**

```bash
php run.php --host=localhost --port=6379
```

**Cluster mode:**

```bash
php run.php --host=localhost --port=7001 --clusterModeEnabled
```

**With TLS:**

```bash
php run.php --host=localhost --port=6379 --tls
```

**Custom data size and iterations:**

```bash
php run.php --dataSize=1000 --iterations=100000,1000000
```

**Only test Valkey GLIDE:**

```bash
php run.php --clients=glide
```

**Quick test (low iterations):**

```bash
php run.php --iterations=100000
```

## Benchmark Methodology

The benchmark tests three operations with weighted probabilities:

- **GET (existing key)**: 64% - Retrieve keys that exist in the database
- **GET (non-existing key)**: 16% - Query keys that don't exist (guaranteed cache misses)
- **SET**: 20% - Write operations
Expand All @@ -74,6 +81,7 @@ The database is pre-populated with 3 million keys before benchmarking to ensure
### Metrics Collected

For each operation type:

- P50, P90, P99 latency (milliseconds)
- Average latency (milliseconds)
- Standard deviation (milliseconds)
Expand Down Expand Up @@ -111,11 +119,8 @@ Results are saved as JSON with the following structure:
]
```

**Note:** The JSON output format is standardized across all GLIDE language implementations (PHP, Python, Node.js, Rust, Go, Java) to enable cross-language performance comparisons. Fields like `num_of_tasks` and `client_count` are maintained for consistency even though PHP always uses single-process execution.

## Current Limitations

- **Single-process only**: Multi-process concurrency is not supported due to ValkeyGlide's Tokio runtime incompatibility with `pcntl_fork()`. The benchmark runs sequentially, measuring per-operation latency rather than true concurrent throughput.
- **No connection pooling**: Each benchmark run uses a single client connection.
- **phpredis comparison**: Requires phpredis extension to be installed separately.

10 changes: 10 additions & 0 deletions benchmarks/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
*/

declare(strict_types=1);

namespace ValkeyGlide\Benchmarks;

// phpcs:disable PSR1.Files.SideEffects
require_once __DIR__ . '/utils.php';

use ValkeyGlide;
use ValkeyGlideCluster;
use Redis;
use RedisCluster;

// Progress reporting constants
const PROGRESS_REPORT_INTERVAL = 100_000; // Report progress every N operations

Expand Down
4 changes: 4 additions & 0 deletions benchmarks/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
*/

declare(strict_types=1);

namespace ValkeyGlide\Benchmarks;

const DEFAULT_PORT = 6379;
const DEFAULT_HOST = 'localhost';
const PROB_GET_EXISTING = 0.64;
Expand Down
2 changes: 1 addition & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "include/glide_bindings.h"

/* ValkeyGlidePHP version */
#define VALKEY_GLIDE_PHP_VERSION "0.10.0"
#define VALKEY_GLIDE_PHP_VERSION "1.0.0"

#define VALKEY_GLIDE_PHP_GET_OBJECT(class_entry, o) \
(class_entry*) ((char*) o - XtOffsetOf(class_entry, std))
Expand Down
34 changes: 20 additions & 14 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ Note: After installation, add "extension=valkey_glide" to your php.ini file.</de
<email>noreply@valkey.io</email>
<active>yes</active>
</lead>
<date>2025-11-27</date>
<date>2025-01-26</date>
<time>18:25:00</time>
<version>
<release>0.10.0</release>
<api>0.10.0</api>
<release>1.0.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</license>
<notes>
Release 0.10.0 of Valkey GLIDE PHP extension.
Release 1.0.0 of Valkey GLIDE PHP extension.

New Features:
- OpenTelemetry support for observability
Expand Down Expand Up @@ -93,7 +93,6 @@ Requirements:
<file name="valkey_glide_pubsub_common.h" role="src" />
<file name="valkey_glide_pubsub_introspection.c" role="src" />
<file name="valkey_glide_pubsub_introspection.h" role="src" />
<file name="phpredis_aliases.php" role="php" />
<file name="OpenTelemetryConfig.php" role="php" />
<file name="OpenTelemetryConfigBuilder.php" role="php" />
<file name="TracesConfig.php" role="php" />
Expand Down Expand Up @@ -142,13 +141,20 @@ Requirements:
</stability>
<license uri="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</license>
<notes>
Release 0.10.0 with new features:
- OpenTelemetry support for observability
- Logging capabilities
- IAM authentication support for ElastiCache and MemoryDB
- Refresh topology configuration
- Multi-Database Support for Cluster Mode (Valkey 9.0+)
- Password API updates
Release 1.0.0 with new features:
- Fix mac development instructions
- bump valkey-glide submodule for root_certs support
- Add release automation workflows and version management
- Update and improve linting infrastructure
- test-modules job queuing indefinitely
- Add TLS support for secure connections
- add markdown linting support for developers
- perf: optimize struct member ordering to reduce padding
- Add script and function commands
- Pub/Sub Implementation
- Add aliases to PHPRedis-compatible class names
- Add connect method for ValkeyGlide client
- Add benchmarks
</notes>
</release>
<release>
Expand Down
44 changes: 0 additions & 44 deletions phpredis_aliases.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/PHPRedisStyleConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function testRedisAliasConnection()
return;
}

require_once __DIR__ . '/../phpredis_aliases.php';
ValkeyGlide::registerPHPRedisAliases();

$this->assertTrue(class_exists('Redis'), 'Redis class alias should exist');
$this->assertTrue(class_exists('RedisException'), 'RedisException class alias should exist');
Expand Down Expand Up @@ -378,7 +378,7 @@ public function testRedisClusterAliasConnection()
return;
}

require_once __DIR__ . '/../phpredis_aliases.php';
ValkeyGlide::registerPHPRedisAliases();

$this->assertTrue(class_exists('RedisCluster'), 'RedisCluster class alias should exist');
$this->assertTrue(class_exists('RedisException'), 'RedisException class alias should exist');
Expand Down
Loading
Loading