DEV Community

Arpit Mohan
Arpit Mohan

Posted on • Originally published at

Why devs like GraphQL; common architecture do's; & Rust performance pitfalls

TL;DR style notes from articles I read today.

Why developers like GraphQL?

  • Superior developer experience in comparison to alternatives.
  • Multiple teams can work independently and in parallel, giving developers a pleasant experience without stalling their development work.
  • There is no versioning of APIs. Adding new fields has no effect on the current client’s call to the APIs.- no pain of maintaining multiple versions of the API.
  • Declarative data fetching lets you ask for exactly what you need and get it.
  • GraphQL schema has several advantages including predictable code, schema acting as a contract between client and server, independent teams and early detection of errors.

Full post here, 6 mins read

How to sleep at night having a cloud service: common architecture do's

  • Have a way of deploying your entire infrastructure as you deploy code.
  • Build a CI/CD pipeline.
  • Configure a load balancer.
  • Use unique identifiers that allow you to trace a request through its lifecycle, and allows someone to see the entire path of the request in the logs. This is highly useful when things go down.
  • Have a log collection and build searchability in it. This comes in handy when searching for one unexpected log.
  • Have monitoring agents to check if your service is up.
  • Automatic autoscaling based on load is great for being elastic under load.
  • Create a way to test out things with 1% of your users for an hour. It is a good way to deploy changes safely. 

Full post here, 7 mins read

Rust performance pitfalls

  • Rust compiles in debug mode by default. It results in faster compilations, but does next to no optimizations, and slows down the code.
  • It uses unbuffered File IO. So, when you write files, wrap them in a BufWriter/BufReader.
  • Read::lines() iterator is easy to use, but it allocates a String for each line. Manually allocate and reuse a String to reduce memory churn to gain a bit of performance.
  • In simple cases, use an iterator instead of an index loop.
  • Avoid needles collect() and allocations.

Full post here, 7 mins read

Get these TL;DR style notes directly to your inbox every weekday by signing up for my newsletter, in.snippets(), here.

Top comments (0)