angel_multiserver 1.0.9

  • README.md
  • Installing
  • Versions
  • 57

multiserver

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.

Response Caching

This plug-in works on any Angel server, not just a LoadBalancer. It caches responses, to lower future response times.

Load Balancing

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.

Session Synchronization

This package also includes three SessionSynchronizer classes:

  • MongoDB
  • Memcached
  • Redis

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')));
}

WebSocket Synchronization

The multiserver is also bundled with a MongoWebSocketSynchronizer.

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  angel_multiserver: "^1.0.9"

2. Install it

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.

3. Import it

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 Go to the documentation of angel_multiserver 1.0.9 Download angel_multiserver 1.0.9 archive
1.0.8 Mar 7, 2017 Go to the documentation of angel_multiserver 1.0.8 Download angel_multiserver 1.0.8 archive
1.0.7 Mar 6, 2017 Go to the documentation of angel_multiserver 1.0.7 Download angel_multiserver 1.0.7 archive
1.0.6 Feb 28, 2017 Go to the documentation of angel_multiserver 1.0.6 Download angel_multiserver 1.0.6 archive
1.0.5 Feb 27, 2017 Go to the documentation of angel_multiserver 1.0.5 Download angel_multiserver 1.0.5 archive
1.0.4 Feb 26, 2017 Go to the documentation of angel_multiserver 1.0.4 Download angel_multiserver 1.0.4 archive
1.0.3 Feb 26, 2017 Go to the documentation of angel_multiserver 1.0.3 Download angel_multiserver 1.0.3 archive
1.0.2 Feb 26, 2017 Go to the documentation of angel_multiserver 1.0.2 Download angel_multiserver 1.0.2 archive
1.0.1 Feb 26, 2017 Go to the documentation of angel_multiserver 1.0.1 Download angel_multiserver 1.0.1 archive
1.0.0 Feb 24, 2017 Go to the documentation of angel_multiserver 1.0.0 Download angel_multiserver 1.0.0 archive

All 15 versions...

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Feb 15, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
55 / 100
Health:
Code health derived from static analysis. [more]
53 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
68 / 100
Overall score:
Weighted score of the above. [more]
57

Platforms

Detected platforms: other

Primary library: package:angel_multiserver/angel_multiserver.dart with components: io, mirrors.

Suggestions

  • Fix lib/src/session_synchronizer.dart.

    Strong-mode analysis of lib/src/session_synchronizer.dart failed with the following error:

    line: 18 col: 44
    Classes can only extend other classes.

  • Fix lib/src/cache.dart.

    Strong-mode analysis of lib/src/cache.dart failed with the following error:

    line: 29 col: 30
    Classes can only extend other classes.

  • Fix further 1 Dart files.

    Similar analysis of the following files failed:

    • lib/src/load_balancer.dart
  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 3 error(s) and 0 warning(s).

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use angel_multiserver.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0
angel_framework ^1.0.0-dev 1.1.1
angel_websocket ^1.0.0 1.1.1
glob ^1.0.0 1.1.5
memcached_client ^0.5.3 0.5.3
mongo_dart ^0.2.10 0.2.10 0.3.1
pool ^1.3.0 1.3.4
random_string ^0.0.1 0.0.1
redis_client ^0.1.16 0.1.16
Transitive dependencies
angel_auth 1.1.0+2
angel_client 1.2.0+1
angel_http_exception 1.0.0
angel_model 1.0.0
angel_route 2.0.5
async 2.0.3 2.0.4
body_parser 1.0.3
bson 0.2.0 0.3.0
charcode 1.1.1
collection 1.14.5
combinator 1.0.0-beta+7
container 0.1.2
convert 2.0.1
crypto 2.0.2+1
fixnum 0.10.7
http_parser 3.1.1
http_server 0.9.7
json_god 2.0.0-beta+1
logging 0.11.3+1
matcher 0.12.1+4
merge_map 1.0.0
meta 1.1.2
mime 0.9.6
mongo_dart_query 0.2.2 0.3.0
more 1.8.1
path 1.5.1
quiver_hashcode 1.0.0
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.3
string_scanner 1.0.2
tuple 1.0.1
typed_data 1.1.5
uuid 0.5.3
web_socket_channel 1.0.6 1.0.7
Dev dependencies
angel_compress ^1.0.0
angel_diagnostics ^1.0.0-dev
angel_errors ^1.0.0-dev
angel_static ^1.1.0
http ^0.11.3 0.11.3+16
test ^0.12.15