Latency Expectations (Important)
| Deployment | Typical Latency |
|---|---|
| Backend on Azure VM (same region as Redis) | ~1.5–2 ms |
| Backend on local laptop → Azure Redis | ~35–70 ms |
Why this happens
When running on an Azure VM in the same region as Redis:
- Traffic stays inside Azure’s backbone network
- Very low RTT and consistent performance
When running from a local machine:
- Requests traverse the public internet
- TLS + WAN latency dominates total response time
✅ Best practice: For realistic performance testing and demos, run the backend in the same region as your Redis instance.
You need to create an Azure Managed Redis instance with the following specifications:
- SKU: Balanced B0/B1
- Features Required: RediSearch, RedisJson module enabled
- Region: Any (recommend same region as your location for better latency)
💡 Tip: For testing with 100 documents, B0/B1 provides comfortable headroom and good performance.
- Python 3.8 or higher
- pip package manager
- The repository includes a small sample parquet file (
sample.parquet) with 100 documents - You may substitute your own parquet file for larger datasets (10k+)
git clone https://github.com/yourusername/redisearch-newswire-demo.git
cd redisearch-newswire-demoMac/Linux:
python3 -m venv venv
source venv/bin/activateWindows:
python -m venv venv
venv\Scripts\activateCopy the template and add your credentials:
cp .env.template .envEdit .env with your actual Azure Managed Redis credentials:
AMR_HOST=your-redis-instance.redis.cache.windows.net
AMR_PORT=10000
AMR_PASSWORD=your-redis-password-here🔑 Where to find credentials:
- Go to Azure Portal
- Navigate to your Redis Cache instance
- Go to "Access keys" section
- Copy the hostname, port, and primary access key
pip install -r requirements.txtcd backend
python create_index.pyThis creates the newswire_idx index with the proper schema for searching news articles.
python load_sample_data.pyThis loads documents from your parquet file into Redis. The small sample takes ~30 seconds.
python -m uvicorn main:app --host 0.0.0.0 --port 8000On the VM:
http://127.0.0.1:8000From your laptop:
http://<VM_PUBLIC_IP>:8000Make sure port 8000 is allowed in your Azure VM network rules.
To delete all indexed data:
redis-cli FT.DROPINDEX newswire_idx DD