10 ms·
Goodreads offloads DynamoDB tables to S3 and queries them with Athena
- manojlds 8y agoFirst lesson - it's taken Goodreads so long and so many users to actually start moving to microservices.
- mi100hael 8y agoI'm not really surprised. Goodreads doesn't have nearly the same level of "real-time" interaction that other social networks do. People can only read (and therefore review) so many books, so it's not like there are millions of users constantly posting new content/comments/etc.
- iamsomewalrus 8y agoIn general, it's not uncommon for startups of the Goodreads vintage to outgrow a simple Rails app and use a more service oriented architecture. We've actually had services for about 5 years now, but we haven't been very vocal about it. As I mentioned in another comment I, personally, wouldn't advocate for new teams or startups to use a service oriented architecture right out the gate. It's too easy to end up with a distributed monolith (circular dependencies between services, services uptimes that are tightly coupled). Engineers also tend to underestimate the build tooling, observability excellence and discipline you need to make it seamless.
- blahville 8y agoHow long before they move back again?
- polskibus 8y agoWeren't Goodreads bought by Amazon a couple of years ago? If so, they might've been pushed to do the move (to microservices, s3, etc) to comply with corporate guidelines/policy not because there wasn't a better/more efficient way to scale.
- starchand 8y agoYeah 2013. You get goodreads info inside your profile section of the kindle apps.
- deleted 8y ago[deleted]
- iamsomewalrus 8y agoThere’s no real policy that I’m aware of internally for teams to use microservices. Amazon has a lot of tooling to make it easy to spin up services, however. The first major project after being acquired was to make a pared down Goodreads experience available on the Kindle Paperwhite. Our first services came out of that initiative to provide a buffer between the Kindle traffic and the Goodreads Rails app. That being said I’ll be the first to caution small teams should avoid microservices at first for fear of creating a distributed monolith.
- mooreds 8y ago> That being said I’ll be the first to caution small teams should avoid microservices at first for fear of creating a distributed monolith. What is your heuristic for determining when it is the right time to look at microservices?
- iamsomewalrus 8y agoThat’s “the question”. I will do my best to bluff through it. Engineering team size: you have teams large enough (~3-4) to own and iterate on a subset of related functionality for the long term. Tooling: you have a builder tools type team that provides a tooling and observability happy path. Traffic scale: you have functionality that operates at 2 or more order of magnitude higher that the rest of your application. Decoupled: you have functionality that can be decoupled from your main app and, most importantly, isn’t required for your main app’s uptime. Like a search service or something. A combination of the above.
- 8y ago
- iamsomewalrus 8y agoHey! I’m the author of this post. I’m pretty chuffed to see this here. Happy to answer any questions.
- eggman222 8y agoHi, thank you for taking the time. I have a couple questions: * Why is the DB scrape written as json instead of directly proto/avro/parquet? Isn't it a lot more costly to store and to handle? * How many events can aws lambda scale to in this kind of architecture?
- iamsomewalrus 8y agoDid we just become best friends with our “I am the Walrus” references? The DB scrape uses a template from Data Pipeline that under the hood uses the Dynamo DB Scan API. Not really surprising, but that API uses JSON. I wanted to use as much off the shelf software as I could to get data into Athena. In this architecture Lambda is only used to listen to the SNS topic that fires when the Data Pipeline job succeeds or fails so we’re not pushing the limits of Lambda at all. You’d probably hit an EC2 limit Witt Data Pipeline before hitting your Lambda limit on the account.
- mooreds 8y agoHappy to post it, but you can thank Corey Quinn from https://lastweekinaws.com/ https://lastweekinaws.com/ for pointing me to it.
- iamsomewalrus 8y agoI did! I'm a big fan of the Last Week in AWS newsletter. https://twitter.com/iamsomewalrus/status/1016368717880389632 https://twitter.com/iamsomewalrus/status/1016368717880389632
- mooreds 8y agoWhy didn't you push the data into a traditional data warehouse or sql database?
- dglass 8y agoWe did something similar at a previous position I had, except we set up an amazon lambda function that was triggered on every insert or update to a DynamoDB table. The lambda function flattened the updated record and inserted it into our redshift cluster, which gave us a real-time ETL pipeline for our DynamoDB data. That allowed us to report on our DynamoDB data just like our relational data.
- iamsomewalrus 8y agoWe have another GR team that does that and it works well. It’s complicated by the fact that at Amazon every team uses their own AWS account. Concretely, a service’s DynamoDB tables don’t exist in the same AWS account let alone the same VPC as the redshift cluster. Obviously, you can figure out the permissions, etc. We’re trying to get to a place where we have the data in S3 for engineers to build products off of and for the oncalls to do sanity checks and the data in Redshift for our BI needs.
- hitekker 8y agoWhy is the author’s HN comment dead? Joe feeneys HN account is indeed iamawalrus; he wasn’t impersonating anyone. Further his comment just said: “Hey! I’m the author of this post. I’m pretty chuffed to see this here. Happy to answer any questions.” I want to hear what he has to say.
- js2 8y agoUnsure, but I vouched for it so it's undead now.
- hitekker 8y agoThanks. I’m guessing it must have triggered some kind of filter.
- cthalupa 8y agoI just had to vouch for his other post in here as well. Looks like some automated filter, for sure.
- iamsomewalrus 8y agoThanks all. Long time lurker, first time commenter.
- sctb 8y agoTheir posts were caught by a software filter. If you email us at hn@ycombinator.com we can be sure to see it—otherwise we may or may not notice on the site.
- kaycebasques 8y agoI use Goodreads as my main book tracker and reviewer. My impression is that Amazon bought it for whatever reason, and then ignored it. It seems like there's so much more potential to a social community around books than what Goodreads offers. The UI also never fails to disappoint. One of the core user features, searching for books, has all sorts of weird quirks. I'll use a very specific query that should guarantee a hit, and nothing comes up. Or, the book that I want will come up for a second, and right as I'm going to select it, the results completely change and the book I want has vanished.
- a_bonobo 8y agoThe website search seems to not be tokenized, it seems to use the entire word only... so if there's a slight difference it won't find anything. The main thing I've noticed in Goodreads since they were bought is a strong focus on Kindle integration. The newer Kindles all have Goodreads integration, you can send notes etc. to the Goodreads profile, the site itself has changed very little (although Goodreads changed a lot of rules around the ability to delete user reviews if they focus too much on author behaviour around the time the Amazon purchase went through https://www.washingtonpost.com/blogs/compost/wp/2013/09/23/is-good-reads-new-policy-really-censorship/?noredirect=on&utm_term=.356b12aa12ab https://www.washingtonpost.com/blogs/compost/wp/2013/09/23/i... )
- Roritharr 8y agoWhat drives me nuts is that the Goodreads integration never made it to Germany. It's frustrating to manually carry over the data while the code is just sitting there behind a country flag.
- WorldMaker 8y agoSimilarly, I find it frustrating that they also just never backported the integration to older models. I have two different kindles and 1) where notes/highlights are stored, and 2) reading status updates to two entirely different websites, one being Goodreads and the other being an older site that is increasingly hard to find in Amazon's sitemap labyrinth.
- mapleoin 8y agoWhat I don't get about Athena is what happens after you've put the data in Athena? Fine, you've got SQL and tabular data, but the type of BI I've had to do usually has a graph or some other visual representation at the end rather than a table. There's only so much data you can import into Excel from a CSV that Athena produces. Usually I find periscope/cluvio to be much better tools for this and then you need to go to redshift. So why bother with all the data pipeline to Athena? Does anyone use this as well as Periscope/Cluvio and can chip in?
- awinder 8y agoQuicksight (https://aws.amazon.com/quicksight/ https://aws.amazon.com/quicksight/)? There are some other 3rd party sources that can utilize athena querying like ChartIO and Looker as well.
- djhworld 8y agoAthena has a JDBC driver and AWS Quicksight is supported if you want to use that
- iamsomewalrus 8y agoAthena is just a front end for the data that a typical user can understand (SQL!). the real value is that the data is: in S3, in a more efficient format (parquet), and available in the Glue catalog. The other replies got it right w.r.t. other BI tools. If you’re using Tableau I think it integrates with Redshift, right? In that case Redshift Spectrum is an option. If you don’t have any existing BI tools then Quicksight is an option or alternatively you can spin up an Elastic Map Reduce (EMR) cluster with your fav open source BI tools
- hkchad 8y agoThere are a bunch of BI tools that can connect to Athena, we use Tableau to cut/slice the data and test out various hypothesis before building a real backend to utilize the data in new ways. I've found RedShift to be a bit expensive for such use cases as our Tableau users only query for a few hrs/day so keeping a RedShift cluster up and running is way overkill, Athena is a good stopgap.
- Jemaclus 8y agoI like the approach, and I've been considering building something similar. Nice writeup. Is this used only for BI or is it used for real-time queries? The reason I ask is because goodreads.com is slow AF, and performance is a concern for me at this point.
- iamsomewalrus 8y agoWe use carrier pigeons from an S3 data center high in the Himalayas to a CloudFront distribution center in Atlantic City (don't ask me, ask the pigeons) to serve all requests. Just BI.
- CobrastanJorji 8y agoIt annoys me that AWS only supports RFC 1149. When will RFC 2549 support be added?
- iamsomewalrus 8y agoYou, dear person, win my undying support and affection.
- Jemaclus 8y agoExcellent. Thanks. (Have you considered using unladen swallows instead?)
- ryanmarsh 8y agoThis is pretty much straight from the DynamoDB best practices. Offload infrequently accessed data (think time series data from previous months) to S3 and use another tool to query it. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-time-series.html#bp-time-series-high-volume https://docs.aws.amazon.com/amazondynamodb/latest/developerg...
- iamsomewalrus 8y ago+1 Everything I've learned the hard way with DynamoDB was in the Best Practices documentation the whole time. Now I've learned to read the Best Practices section of any AWS service before I start implementing. It saves a lot of heartache
- the_arun 8y agoIn RDBMS world, this is very similar to partitioning large tables by date - moving window pattern. Drop the older partitions outside of the window.
- mariogintili 8y agohow can I make my data more complicated? DynamoDB(non relational, key-value esque WTF-store) + something else
- iamsomewalrus 8y agoCarrier pigeon transport?
- the_arun 8y agoIsn't it expensive to use S3+Athena instead of DynamoDB?
- iamsomewalrus 8y agoThis architecture is meant for business intelligence purposes, not for oltp queries. You're right, it would be pretty expensive to power a user facing service this way. However, I read a harrowing / awe-inspring blog post about someone doing just that. So...¯\_(ツ)_/¯
- desireco42 8y agoIt looks like busy work to me. I love Rails but sometimes you get to teams where people just don't know what to do with themselves, usually good developers, and they come up with yak shaving and reinventing the wheel for no good reason. From what I can gather, Amazon acquired them and now they have to figure out something to do. There is plenty of UX to fix.
- mark_l_watson 8y agoHow does Athena work? The charge is $5 per terrabyte scanned, which indicates (maybe) that no indices are used and queries are processed by a scan through the data. Is this correct?
- pacuna 8y agoyes. It uses schema-on-read so it doesn't support indices as far as I know. And yeah, it scans through the data using the schema you define previously
- iamsomewalrus 8y agoThe docs are a good place to start to get a sense of what Athena can do: https://docs.aws.amazon.com/athena/latest/ug/what-is.html https://docs.aws.amazon.com/athena/latest/ug/what-is.html There are no indexes in the traditional MySQL / Postgres sense of the word. You can, however, layout the data to make your querying more efficient. See: https://docs.aws.amazon.com/athena/latest/ug/partitions.html https://docs.aws.amazon.com/athena/latest/ug/partitions.html
- aws_user_111 8y agoWith the launch of https://aws.amazon.com/about-aws/whats-new/2018/07/aws-glue-now-supports-reading-from-amazon-dynamodb-tables/ https://aws.amazon.com/about-aws/whats-new/2018/07/aws-glue-... Wouldn't using ETL Glue job to directly dump data in parquet format be better?
- iamsomewalrus 8y ago100%. Expect a follow up in the future with a simplified pipeline.
- aws_user_111 8y agoCool.