POC for REST API using Finch and friends.
- API Framework
- Monitoring
- Configuration
- Logging
- Profiling
- Process Management
- Testing
- API Documentation
finagle/finch is a pure functional REST API framework based on Twitter's Finagle.
Finagle is an extensible RPC system for the JVM, used to construct high-concurrency servers. Finagle implements uniform client and server APIs for several protocols, and is designed for high performance and concurrency. Most of Finagle’s code is protocol agnostic, simplifying the implementation of new protocols.
Twitter use Finagle in their production and is actively developed.
Finagle comes with twitter/twitter-server.
TwitterServer defines a template from which servers at Twitter are built. It provides common application components such as an administrative HTTP server, tracing, stats, etc. These features are wired in correctly for use in production at Twitter.
Also check the finagle-stats subproject.
Need to implement our own tool to check logs and generate alerts.
Finagle use twitter/util for logging, however it has some serious performance problem (Or we just dont understand it enough to tune it correctly). Since log4j with logback is industry default so we use log4j instead of twitter.util.logging.
Might want to use Scribe or Apache Flume.
kubernetes/heapster works great with twitter-server.
The profile can be analysised using gperftools. Just brew install gperftools
if using osx.
Zipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in microservice architectures. It manages both the collection and lookup of this data. Zipkin’s design is based on the Google Dapper paper.
Check the following gist for finch integration.
Currently finagle-zipkin requires Scribe and zipkin itself requires Cassandra, ElasticSearch. or at least MySQL as backend.
Twitter server can integrate nicely with Apache Mesos.
/admin/health
is still useful. By default, respond with content-body “OK”. This endpoint can be managed manually by mixing in the Lifecycle.Warmup trait with your server.
Finch/Fiangle come with a simple test framework works great with ScalaTest. However, we might need to setup DI to mock external services for unit test.
For DI solution, adamw/macwire is probably a better light-weight solution than google/guice or Spring.
- wg/wrk is a great stress test tool, Gatling works also fine.
- scalacheck can be used as correctness regression test.
- ScalaMeter can be used for performance regression test.
- Robot Framework is a great acceptance test tool.
- twitter/diffy is a bug detection tool. Consider using it for staging.
Swagger.io would be great. However, there is currently no way to generate swagger.io documentation from Finagle. Probably need to implement our own or hand-write YAML.