@celerispay/hazelcast-client 3.12.5 → 3.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -87
- package/CHANGES_UNCOMMITTED.md +52 -0
- package/FAILOVER_FIXES.md +148 -230
- package/FAULT_TOLERANCE_IMPROVEMENTS.md +208 -0
- package/HAZELCAST_CLIENT_EVOLUTION.md +402 -0
- package/QUICK_START.md +184 -95
- package/RELEASE_SUMMARY.md +227 -147
- package/lib/HeartbeatService.js +11 -2
- package/lib/PartitionService.d.ts +14 -0
- package/lib/PartitionService.js +32 -9
- package/lib/invocation/ClientConnection.d.ts +14 -0
- package/lib/invocation/ClientConnection.js +95 -1
- package/lib/invocation/ClientConnectionManager.d.ts +95 -0
- package/lib/invocation/ClientConnectionManager.js +369 -7
- package/lib/invocation/ClusterService.d.ts +75 -5
- package/lib/invocation/ClusterService.js +430 -15
- package/lib/invocation/ConnectionAuthenticator.d.ts +11 -0
- package/lib/invocation/ConnectionAuthenticator.js +85 -12
- package/lib/invocation/CredentialPreservationService.d.ts +137 -0
- package/lib/invocation/CredentialPreservationService.js +369 -0
- package/lib/invocation/HazelcastFailoverManager.d.ts +102 -0
- package/lib/invocation/HazelcastFailoverManager.js +285 -0
- package/lib/invocation/InvocationService.js +8 -0
- package/lib/nearcache/StaleReadDetectorImpl.js +31 -4
- package/lib/proxy/ProxyManager.js +25 -4
- package/package.json +20 -28
package/QUICK_START.md
CHANGED
|
@@ -1,143 +1,232 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Hazelcast Node.js Client - Quick Start Guide
|
|
2
|
+
|
|
3
|
+
## Version Information
|
|
4
|
+
- **Package**: `@celerispay/hazelcast-client`
|
|
5
|
+
- **Version**: `3.12.5-1`
|
|
6
|
+
- **Publisher**: CelerisPay
|
|
7
|
+
- **Base Version**: 3.12.5 (Hazelcast Inc.)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
This is a production-ready, enhanced version of the Hazelcast Node.js client with critical failover fixes that resolve connection management issues in production environments.
|
|
2
11
|
|
|
3
12
|
## Installation
|
|
4
13
|
|
|
14
|
+
### Install the Fixed Version
|
|
5
15
|
```bash
|
|
6
|
-
|
|
7
|
-
|
|
16
|
+
npm install @celerispay/hazelcast-client@3.12.5-1
|
|
17
|
+
```
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
### Verify Installation
|
|
20
|
+
```bash
|
|
21
|
+
npm list @celerispay/hazelcast-client
|
|
22
|
+
# Should show version 3.12.5-1
|
|
11
23
|
```
|
|
12
24
|
|
|
13
25
|
## Basic Usage
|
|
14
26
|
|
|
27
|
+
### Import the Client
|
|
28
|
+
```javascript
|
|
29
|
+
const { ClientConfig, HazelcastClient } = require('@celerispay/hazelcast-client');
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Create Client Configuration
|
|
15
33
|
```javascript
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const config = new ClientConfig();
|
|
35
|
+
config.networkConfig.addresses = ['127.0.0.1:5701', '127.0.0.1:5702'];
|
|
36
|
+
|
|
37
|
+
// Enhanced failover settings (automatically configured)
|
|
38
|
+
config.properties['hazelcast.client.connection.health.check.interval'] = 5000;
|
|
39
|
+
config.properties['hazelcast.client.failover.cooldown'] = 5000;
|
|
40
|
+
config.properties['hazelcast.client.partition.refresh.min.interval'] = 2000;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Connect and Use
|
|
44
|
+
```javascript
|
|
45
|
+
async function main() {
|
|
46
|
+
const client = await HazelcastClient.newHazelcastClient(config);
|
|
47
|
+
|
|
48
|
+
const map = await client.getMap('myMap');
|
|
49
|
+
await map.put('key', 'value');
|
|
50
|
+
|
|
51
|
+
const value = await map.get('key');
|
|
52
|
+
console.log('Value:', value);
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
await client.shutdown();
|
|
36
55
|
}
|
|
56
|
+
|
|
57
|
+
main().catch(console.error);
|
|
37
58
|
```
|
|
38
59
|
|
|
39
60
|
## Key Improvements
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
62
|
+
### 1. **Robust Failover**
|
|
63
|
+
- Automatic detection of node failures
|
|
64
|
+
- Intelligent failover to healthy nodes
|
|
65
|
+
- Failover cooldown to prevent rapid switching
|
|
66
|
+
|
|
67
|
+
### 2. **Connection Health Monitoring**
|
|
68
|
+
- Continuous connection health checks
|
|
69
|
+
- Automatic cleanup of failed connections
|
|
70
|
+
- Prevention of connection leakage
|
|
71
|
+
|
|
72
|
+
### 3. **Address Blocking System**
|
|
73
|
+
- Temporary blocking of failed addresses (30 seconds)
|
|
74
|
+
- Automatic unblocking after block duration
|
|
75
|
+
- Prevention of repeated connection attempts
|
|
47
76
|
|
|
48
|
-
|
|
77
|
+
### 4. **Enhanced Error Handling**
|
|
78
|
+
- Near cache crash prevention during failover
|
|
79
|
+
- Graceful degradation during cluster changes
|
|
80
|
+
- Comprehensive error logging
|
|
49
81
|
|
|
50
|
-
###
|
|
82
|
+
### 5. **Intelligent Reconnection**
|
|
83
|
+
- Automatic reconnection to recovered nodes
|
|
84
|
+
- Smart ownership management
|
|
85
|
+
- Partition table refresh management
|
|
51
86
|
|
|
87
|
+
## Configuration Properties
|
|
88
|
+
|
|
89
|
+
### Connection Management
|
|
52
90
|
```javascript
|
|
53
|
-
properties
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
'hazelcast.client.connection.max.retries': 3,
|
|
57
|
-
'hazelcast.client.connection.retry.delay': 1000,
|
|
58
|
-
|
|
59
|
-
// Failover control
|
|
60
|
-
'hazelcast.client.failover.cooldown': 5000,
|
|
61
|
-
'hazelcast.client.partition.refresh.min.interval': 2000,
|
|
62
|
-
|
|
63
|
-
// Retry behavior
|
|
64
|
-
'hazelcast.client.invocation.max.retries': 10,
|
|
65
|
-
'hazelcast.client.partition.failure.backoff': 2000
|
|
66
|
-
}
|
|
91
|
+
config.properties['hazelcast.client.connection.health.check.interval'] = 5000; // 5 seconds
|
|
92
|
+
config.properties['hazelcast.client.connection.max.retries'] = 3; // Max 3 retries
|
|
93
|
+
config.properties['hazelcast.client.connection.retry.delay'] = 1000; // 1 second delay
|
|
67
94
|
```
|
|
68
95
|
|
|
69
|
-
###
|
|
96
|
+
### Failover Control
|
|
97
|
+
```javascript
|
|
98
|
+
config.properties['hazelcast.client.failover.cooldown'] = 5000; // 5 seconds cooldown
|
|
99
|
+
config.properties['hazelcast.client.partition.refresh.min.interval'] = 2000; // 2 seconds minimum
|
|
100
|
+
```
|
|
70
101
|
|
|
102
|
+
### Retry Behavior
|
|
71
103
|
```javascript
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
connectionAttemptLimit: 5, // Increased from 2
|
|
75
|
-
connectionTimeout: 10000, // Increased from 5000
|
|
76
|
-
redoOperation: true, // Changed from false
|
|
77
|
-
smartRouting: true
|
|
78
|
-
}
|
|
104
|
+
config.properties['hazelcast.client.invocation.max.retries'] = 10; // Max 10 retries
|
|
105
|
+
config.properties['hazelcast.client.partition.failure.backoff'] = 2000; // 2 seconds backoff
|
|
79
106
|
```
|
|
80
107
|
|
|
81
|
-
## Testing
|
|
108
|
+
## Testing
|
|
82
109
|
|
|
110
|
+
### Run the Test Suite
|
|
83
111
|
```bash
|
|
84
|
-
# Run the failover tests
|
|
85
|
-
npm test -- --grep "Connection Failover Test"
|
|
86
|
-
|
|
87
|
-
# Run all tests
|
|
88
112
|
npm test
|
|
89
113
|
```
|
|
90
114
|
|
|
91
|
-
|
|
115
|
+
### Verify Configuration
|
|
116
|
+
```bash
|
|
117
|
+
node -e "
|
|
118
|
+
const { ClientConfig } = require('@celerispay/hazelcast-client');
|
|
119
|
+
const config = new ClientConfig();
|
|
120
|
+
console.log('Enhanced properties:', Object.keys(config.properties).filter(p => p.includes('connection') || p.includes('failover')));
|
|
121
|
+
"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Migration from Original Client
|
|
92
125
|
|
|
93
|
-
1. **Update
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
```
|
|
126
|
+
### 1. **Update Package Name**
|
|
127
|
+
```bash
|
|
128
|
+
# Remove original
|
|
129
|
+
npm uninstall hazelcast-client
|
|
99
130
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const { HazelcastClient } = require('hazelcast-client');
|
|
104
|
-
|
|
105
|
-
// After
|
|
106
|
-
const { HazelcastClient } = require('@celerispay/hazelcast-client');
|
|
107
|
-
```
|
|
131
|
+
# Install fixed version
|
|
132
|
+
npm install @celerispay/hazelcast-client@3.12.5-1
|
|
133
|
+
```
|
|
108
134
|
|
|
109
|
-
|
|
135
|
+
### 2. **Update Import Statement**
|
|
136
|
+
```javascript
|
|
137
|
+
// Before
|
|
138
|
+
const { ClientConfig } = require('hazelcast-client');
|
|
110
139
|
|
|
111
|
-
|
|
140
|
+
// After
|
|
141
|
+
const { ClientConfig } = require('@celerispay/hazelcast-client');
|
|
142
|
+
```
|
|
112
143
|
|
|
113
|
-
|
|
114
|
-
-
|
|
144
|
+
### 3. **No Code Changes Required**
|
|
145
|
+
- All existing code will work unchanged
|
|
146
|
+
- Failover behavior will automatically improve
|
|
147
|
+
- Connection management will be more robust
|
|
115
148
|
|
|
116
|
-
|
|
117
|
-
- ✅ **After**: Failed connections are properly cleaned up
|
|
149
|
+
## Production Recommendations
|
|
118
150
|
|
|
119
|
-
|
|
120
|
-
|
|
151
|
+
### 1. **Enable Statistics**
|
|
152
|
+
```javascript
|
|
153
|
+
config.properties['hazelcast.client.statistics.enabled'] = true;
|
|
154
|
+
```
|
|
121
155
|
|
|
122
|
-
|
|
123
|
-
|
|
156
|
+
### 2. **Monitor Logs**
|
|
157
|
+
Watch for these log messages:
|
|
158
|
+
- `"Starting failover process..."`
|
|
159
|
+
- `"Failover completed successfully"`
|
|
160
|
+
- `"Connection health check interval"`
|
|
161
|
+
- `"Address blocked for X seconds"`
|
|
124
162
|
|
|
125
|
-
|
|
126
|
-
|
|
163
|
+
### 3. **Load Testing**
|
|
164
|
+
Test failover scenarios under load:
|
|
165
|
+
- Stop partition owner nodes
|
|
166
|
+
- Monitor automatic failover
|
|
167
|
+
- Verify reconnection to recovered nodes
|
|
127
168
|
|
|
128
|
-
|
|
169
|
+
### 4. **Network Configuration**
|
|
170
|
+
```javascript
|
|
171
|
+
config.networkConfig.connectionAttemptLimit = 5; // Increased from default
|
|
172
|
+
config.networkConfig.connectionTimeout = 10000; // Increased from default
|
|
173
|
+
config.networkConfig.redoOperation = true; // Enable for better failover
|
|
174
|
+
```
|
|
129
175
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
176
|
+
## What's Fixed
|
|
177
|
+
|
|
178
|
+
### ✅ **Connection Bombardment**
|
|
179
|
+
- No more repeated connection attempts to failed nodes
|
|
180
|
+
- Intelligent address blocking prevents network spam
|
|
181
|
+
- Connection health monitoring detects failures early
|
|
182
|
+
|
|
183
|
+
### ✅ **Failover Failures**
|
|
184
|
+
- Automatic failover to healthy nodes
|
|
185
|
+
- Proper partition table management during failover
|
|
186
|
+
- Failover cooldown prevents rapid switching
|
|
187
|
+
|
|
188
|
+
### ✅ **Near Cache Crashes**
|
|
189
|
+
- Comprehensive error handling prevents crashes
|
|
190
|
+
- Graceful degradation during cluster changes
|
|
191
|
+
- Safe fallback values during failover
|
|
192
|
+
|
|
193
|
+
### ✅ **Connection Leakage**
|
|
194
|
+
- Automatic cleanup of failed connections
|
|
195
|
+
- Periodic connection health checks
|
|
196
|
+
- Memory leak prevention
|
|
197
|
+
|
|
198
|
+
### ✅ **Hanging Operations**
|
|
199
|
+
- Maximum retry limits prevent infinite loops
|
|
200
|
+
- Proper error handling and logging
|
|
201
|
+
- Graceful failure with user feedback
|
|
134
202
|
|
|
135
203
|
## Support
|
|
136
204
|
|
|
137
|
-
|
|
138
|
-
- **
|
|
139
|
-
- **
|
|
205
|
+
### **Package Information**
|
|
206
|
+
- **Name**: `@celerispay/hazelcast-client`
|
|
207
|
+
- **Version**: `3.12.5-1`
|
|
208
|
+
- **Publisher**: CelerisPay
|
|
209
|
+
|
|
210
|
+
### **Documentation**
|
|
211
|
+
- **Technical Details**: See `FAILOVER_FIXES.md`
|
|
212
|
+
- **Release Notes**: See `CHANGELOG.md`
|
|
213
|
+
- **Repository**: https://github.com/celerispay/hazelcast-nodejs-client
|
|
214
|
+
|
|
215
|
+
### **Issues and Support**
|
|
216
|
+
- **GitHub Issues**: https://github.com/celerispay/hazelcast-nodejs-client/issues
|
|
217
|
+
- **Professional Support**: Available from CelerisPay
|
|
218
|
+
|
|
219
|
+
## Expected Results
|
|
220
|
+
|
|
221
|
+
After implementing this fixed version, you should see:
|
|
222
|
+
|
|
223
|
+
1. **Stable Connections**: No more connection bombardment to failed nodes
|
|
224
|
+
2. **Automatic Failover**: Seamless switching to healthy nodes when failures occur
|
|
225
|
+
3. **Better Performance**: Reduced network traffic and improved response times
|
|
226
|
+
4. **Cleaner Logs**: Fewer error messages and better failure information
|
|
227
|
+
5. **Production Stability**: Reliable operation even during cluster topology changes
|
|
140
228
|
|
|
141
229
|
---
|
|
142
230
|
|
|
143
|
-
**
|
|
231
|
+
**Ready for Production**: This version has been thoroughly tested and is ready for production deployment with professional support from CelerisPay.
|
|
232
|
+
|