Support for running Dart applications, specifically Angel apps, across multiple servers.
The idea is that you have one master server running the load balancer, and the child applications call a session synchronizer.
Dedicated WebSocket support is also present.
See the examples.
This plug-in works on any Angel
server, not just a LoadBalancer
.
It caches responses, to lower future response times.
This package exposes a LoadBalancer
class, which extends Angel
,
and can be used like a normal server.
The default algorithm is a simple round-robin, but it can be extended for your own purposes.
Three load-balancing algorithms are included:
ROUND_ROBIN
(default)LEAST_LATENCY
STICKY_SESSION
The LoadBalancer also supports HTTPS and WebSockets. Bam.
You can also provide a maxConcurrentConnections
to pool
server resources and prevent premature crashes.
This package also includes three SessionSynchronizer
classes:
These are simply plugins that serialize and deserialize session data to external data stores. Try to call them as early as possible in your application, so that session data is loaded before any business logic.
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_multiserver/angel_multiserver.dart';
import 'package:mongo_dart/mongo_dart.dart';
main() async {
var app = new Angel();
var db = new Db('<connection-string>');
await db.open();
await app.configure(
new MongoSessionSynchronizer(db.collection('sessions')));
}
The multiserver is also bundled with a MongoWebSocketSynchronizer
.
Add this to your package's pubspec.yaml file:
dependencies:
angel_multiserver: ^1.0.9
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:angel_multiserver/angel_multiserver.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
1.0.9 | Mar 28, 2017 |
|
|
1.0.8 | Mar 7, 2017 |
|
|
1.0.7 | Mar 6, 2017 |
|
|
1.0.6 | Feb 28, 2017 |
|
|
1.0.5 | Feb 27, 2017 |
|
|
1.0.4 | Feb 26, 2017 |
|
|
1.0.3 | Feb 26, 2017 |
|
|
1.0.2 | Feb 26, 2017 |
|
|
1.0.1 | Feb 26, 2017 |
|
|
1.0.0 | Feb 24, 2017 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
52
|
Health:
Code health derived from static analysis.
[more]
|
--
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
--
|
Overall:
Weighted score of the above.
[more]
|
26
|
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in pubspec.yaml
.
The SDK constraint in pubspec.yaml
doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
Make sure dartdoc
successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.19.0 |