4 ms·
I'm sorry but why would I go through HTTP to query data? Why can't I just hit the database directly without the overhead of HTTP? Does a cleaner and being more
by jister 11y ago
I'm sorry but why would I go through HTTP to query data? Why can't I just hit the database directly without the overhead of HTTP? Does a cleaner and being more standards-compliant worth the overhead of passing through HTTP?
And what happens when you start applying complex business rules that needs to scale? So many questions about this approach...
- mooreds 11y agoTo force yourself to go through a service. To abstract away underlying implementation details. More here in the value of services (Yegge's rant): https://plus.google.com/+RipRowan/posts/eVeouesvaVX https://plus.google.com/+RipRowan/posts/eVeouesvaVX
- javaJake 11y agoIncredible read. Thank you for sharing that post.
- swah 11y agoThose are big organizations, though. Maybe smaller orgs / single devs should start with a monolith? http://martinfowler.com/articles/microservices.html http://martinfowler.com/articles/microservices.html http://martinfowler.com/bliki/MonolithFirst.html http://martinfowler.com/bliki/MonolithFirst.html http://martinfowler.com/articles/microservice-trade-offs.html http://martinfowler.com/articles/microservice-trade-offs.htm...
- bpicolo 11y agoAnd by doing so you remove all the performance from what's hopefully the most-performant part of your stack. =/ A database IS a service. It's just not a 'restful web service'. Making it one doesn't gain you any useful abstraction for SOA.
- sitkack 11y agoNot true, I now can get read only data using curl inside of a cronjob. This is really powerful. Someone now needs to make a similar system for Redis.
- caf 11y agoPresumably because browsers talk HTTP, but don't talk Postgres' native protocol.
- twistedpair 11y agoJust don't forget to secure it. Reminds me of when people thought it was a good idea to expose the REST API of ElasticSearch directly as their API and then got p0wned. Using "REST as an abstraction layer" isn't the same as taking someone else's OTC API, calling it your own, and exposing it to the public.
- scttnlsn 11y agoYeah, this seems great if you want to completely eliminate the middle tier and have a client application talk directly w/ the database. I'm curious why there's an entire query API via query string parameters. Why not just expose a single POST /query endpoint where you can send some SQL?
- elchief 11y agoCuz you use GET for queries with REST
- vkjv 11y agoYou can take advantage of browser and CDN caching with a GET but not with a POST. Throw in ETAGs and you can do a lot of cool stuff to make things scale really well.
- deleted 11y ago[deleted]
- spacemanmatt 11y agoSqueezing the middle tier as flat as possible is my actual strategy and goal in many distributed environments. That's totally feasible with modern tools. But sending SQL from the client is dangerous, and in this forum you'll get some interesting looks suggesting that.
- twistedpair 11y agoAmen. Whatever happened to the binary driver? Calling a Prepared Statement over a binary driver to a localhost or in rack DB and we're talking microsec level query times possible. Always annoyed when I spin up Hello World examples of all the new Rest Hotness db's to discovered that a PK query on a fresh install with only 10 rows still takes 10ms! Quite unclear why you'd layer all the HTTP and marshalling overhead on backend service calls, other than to ensure you always have slow requests.