So we had a go at voicemail with S3. I won't bore you with the detail, but in summary;
What we wanted to achieve;
- Store & receive voicemail recordings on S3, reliably and without a considerable delay.
- Allow all servers in the cluster to access a voicemail, irrespective of what server it was recorded on, without keeping local copies on the server (keep servers 'light').
- Allow customers to access voicemail recordings through our customer toolbox (we don't intend to give customers access to the FPBX gui; why? security, end-user's changing things they shouldn't etc).
The set-up;
- 2 x VPS running FS 1.6 & FPBX 4.2
- Poor mans cluster; database sharing setup between two servers (no proxy etc)
- S3 via ap-southeast-2 zone (servers were on the same AS/transit path: ~10ms to aws)
We tried two fuse based file systems (S3FS & Goofys);
-- S3FS worked out of the box for us.
-- Goofys looked the goods on paper (supposed to be faster and there's a 'cheap' setting which reduces the number of put/get/list requests); we had some permission issues to sort out first, but soon realised it doesn't handle appending to files on s3 very well; given the way FS creates a file first then appends/saves the data to the created file, it didn't end up working for us. Would have liked to run the tests with Goofys but it just wouldn't play ball.
General
Using S3FS, FS had no issue storing and retrieving the files. Our test servers were a few non-aws 2GB VPS' we spun up that were relatively close (~10ms) from the ap-southeast-2 (Sydney) zone.
While we saw a slight delay in retrieving voicemail via a handset (and when I mean slight; I mean we could notice because we were looking for it, but doubt an end user would notice it compared to local filesystem).
The set-up was a poor mans cluster with just database sharing; Both servers were able to access the voicemail recordings without any issue (process to test: forced the user to register to the 1st server to create the voicemail recording, then retrieved on 1st server; forced user to register to 2nd server and retrieve voicemail. All successful).
DigiDaz's comment about viewing voicemails through the FPBX gui was spot on - took quite a while to load and consumed a significant amount of get/list requests (we went through our AWS free tier allowance in a day with only a handful of voicemails).
Pro's
-- Not too difficult to set-up
-- Worked fine in a test environment. We want to put more effort into testing (under load, multi-read's, bigger latency), but as a proof of concept, it does work and the results aren't as bad as we were expecting
-- Most fused-based filesystems that work with s3 offer a caching component, which may be useful (i.e. store locally in cache for one hour, in the event user needs to retrieve again; reduces calls to s3)
-- s3 offers cross region replication for a 'higher availability' offering, however given how often you hear of aws s3 being unavailable, I'm not sure the cost is justified.
Con's
-- If you intend on using the Voicemail section of FPBX with S3, expect it to generate a significant amount of put/get/list, which could get expensive if you have a busy FPBX setup and be slow to the point it is almost unusable. There are other object/block storage offerings out there that don't charge for put/get/list's, which may be an option but the speed would still be an issue. We're not particularly fussed about this as we don't offer customers access to the FPBX GUI. This may cause issues for us internally but is worth the effort to find a workaround for.
-- If there's a network connectivity issue, or the network is congested it will certainly have an impact. We intended to run servers outside the AWS network, including across multiple AS's and different transit/peering routes, which brings its own complexities as we don't own that connectivity.
What to watch out for?
-- Proximity of your server to the chosen AWS s3 zone. If ~10ms average offers a small delay in read/writing, the worst you'd want to consider is probably 20-30ms before the delay in read/writing becomes noticeable. Our intent is to look into this with FPBX instances placed further away when we get time.
-- We used VPS' for the test environment as they were easy to setup, but they obviously lack the processing power of bare-metal. We might see performance improve slightly on bare metal, however we doubt by lot as the VPS' weren't under any load (i.e. this testing was the only thing we were doing in that environment at the time).
Other alternatives?
-- GlusterFS; although we're not interested in running our own clustered filesystem and liked the idea of the S3 model - someone else takes care of it with an SLA. We use S3 in another part of the business, so it made sense to look at it due to familiarity.
-- Other Storage as a Service offerings, however we assume they'll all perform near enough the same (AWS, GCP, Azure etc) for Australian zones.
-- Per Luis, create a mount-point and sync when a recording is generated. We didn't explore this in any detail, but could be considered by those not happy with the performance from s3
-- NFS; but don't like the idea of NFS across the internet
Overall;
We'll continue to look at this option in more detail. We're happy with the results thus far and we satisfied our initial query around access times when retrieving a voicemail.
We'll also try and spin up a another two servers in slightly more distant locations to see what those results look like, which would be more comparable to the cluster we have in operation at the moment. If we remember, we'll also keep an eye on the put/get/list volumes in a bit more detail.