Skip to content

Commit 4fa1e43

Browse files
authored
Merge pull request #721 from jasonacox/v4.9.0
v4.9.0 - Performance Improvements
2 parents 2386105 + 275fb6d commit 4fa1e43

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

RELEASE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
# RELEASE NOTES
22

3+
## v4.9.0 - Performance Improvements
4+
5+
### Proxy t86 (20 Dec 2025)
6+
7+
This version introduces the pypowerwall proxy t86 based on pypowerwall v0.14.5. Optimizations are added for TEDAPI and should help with stability and performance for Powerwall 3 owners.
8+
9+
* **Performance Caching System**:
10+
- Added comprehensive performance caching layer for high-impact API routes
11+
- Implemented `cached_route_handler()` pattern for consistent cache management across endpoints
12+
- Added performance caching to: `/aggregates`, `/api/meters/aggregates`, `/vitals`, `/strings`, `/temps/pw`, `/alerts/pw`, `/freq`, `/pod`, `/json`, `/csv`, `/csv/v2` endpoints
13+
- Shared cache optimization: `/aggregates` and `/api/meters/aggregates` use same cache key for identical payloads
14+
- Optimized `/csv` and `/json` endpoints from 9 API calls to 6 calls (33% reduction) using aggregates consolidation
15+
- Eliminated 400-600ms overhead from redundant `get_components()` fallback calls
16+
- Typical performance improvements: 99.6% faster cached responses (764ms → 2.9ms for `/aggregates`)
17+
- Cache memory monitoring added to `/stats` endpoint with detailed memory usage breakdown
18+
- Average overall response time improvement: 58% reduction (165.7ms → 70.2ms)
19+
20+
**Performance Metrics Comparison:**
21+
22+
| API Route | Before (ms) | After (ms) | Improvement | Usage Count | Impact Reduction |
23+
|-----------|-------------|------------|-------------|-------------|------------------|
24+
| `/api/meters/aggregates` | 821.5 | 151.3 | **81.6%**| 7,992 | 5,355 seconds saved |
25+
| `/aggregates` | 764.8 | 150.7 | **80.3%**| 3,880 | 2,383 seconds saved |
26+
| `/strings` | 545.7 | 37.3 | **93.2%**| 3,945 | 2,006 seconds saved |
27+
| `/vitals` | 339.3 | 33.9 | **90.0%**| 3,946 | 1,205 seconds saved |
28+
| `/alerts/pw` | 382.9 | 87.8 | **77.1%** 🚀 | 3,881 | 1,145 seconds saved |
29+
| `/temps/pw` | 266.0 | 253.6 | **4.7%**| 3,880 | 48 seconds saved |
30+
31+
*Total Impact Reduction: ~12,142 seconds (3.4 hours) of response time saved per 8-hour period*
32+
33+
* **Performance Testing Tool**:
34+
- Added [perf_test.py](https://github.com/jasonacox/pypowerwall/blob/main/proxy/perf_test.py) script for comprehensive API performance testing and analysis
35+
- Tests 27 production API routes with impact scoring (response_time × usage_frequency)
36+
- Provides min/max/average response times with color-coded performance indicators
37+
38+
* **Bug Fixes**:
39+
- Fixed undefined variable `cache_ttl_seconds` error in graceful degradation system
40+
- Fixed TypeError in `/csv/v2` endpoint: removed invalid `force=False` parameter from `level()`, `grid_status()`, and `get_reserve()` calls
41+
- Fixed variable shadowing bug in `grid_status()` method where `type` parameter shadowed Python's built-in `type()` function
42+
- Renamed `type` parameter to `output_type` throughout codebase for consistency and correctness
43+
44+
* **Code Quality & Maintainability**:
45+
- Centralized cache logic in reusable helper functions for improved consistency
46+
- Improved error handling and logging in `safe_pw_call()` wrapper
47+
- Added unit tests for CSV endpoints (`TestCSVEndpoints` class with 7 test cases)
48+
- Enhanced error tracking with network error summaries and endpoint statistics
49+
- Enhanced documentation with comprehensive performance testing guide
50+
351
## v4.8.8 - Tesla-History Fix
452

553
* Revise tesla-history script backup event history retrieval due to Tesla API changes by @mcbirse in https://github.com/jasonacox/Powerwall-Dashboard/pull/717 - addresses https://github.com/jasonacox/Powerwall-Dashboard/issues/714

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.8.8
1+
4.9.0

powerwall.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
start_period: 60s
2929

3030
pypowerwall:
31-
image: jasonacox/pypowerwall:0.14.4t85
31+
image: jasonacox/pypowerwall:0.14.5t86
3232
container_name: pypowerwall
3333
hostname: pypowerwall
3434
restart: unless-stopped
@@ -95,6 +95,10 @@ services:
9595
container_name: grafana
9696
hostname: grafana
9797
restart: unless-stopped
98+
ulimits:
99+
nofile:
100+
soft: 65536
101+
hard: 65536
98102
user: "${PWD_USER:-1000:1000}"
99103
volumes:
100104
- type: bind

upgrade.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
set -e
77

88
# Set Globals
9-
VERSION="4.8.8"
9+
VERSION="4.9.0"
1010
CURRENT="Unknown"
1111
COMPOSE_ENV_FILE="compose.env"
1212
INFLUXDB_ENV_FILE="influxdb.env"

0 commit comments

Comments
 (0)