423 points · by revskill · 7y ago · 164 comments
Why can’t the world move in that direction, instead of the insane Kubernetes hype that’s prevalent these days?
And for 500,000,000 people.
Also it looks "beautiful" to your eye, from a programming perspecting it looks really un-readable if you don't use FP.
https://github.com/Gabriel439/simple-twitter/blob/master/Mai...
I don't mean this as a slight, and I myself am slacking in the same regard, but it's depressing to me that this attitude is so prevalent among professionals.
There might be some good engineering reasons that tools like Docker and Kubernetes have much more traction than Nix, but "it's unfamiliar if you don't use FP" is a terrible one. It doesn't require that much investment to become familiar, and there seems to be many fantastic advantages to functional approaches.
Why does our industry tolerate this laziness?
If any of them could drive the Nix project from within their own walls we would be going that route.
1. Run anything anywhere (no platform lockin)
2. The ability to talk about your arch using a shared dialect
3. Tooling that integrated with the API server for everything storage and DB (things like Rook), networking and security (CNIs), observability (Service Mesh), and many more abstractions.
Kube is the low level dialect. The tooling around it makes it work like you want.
You're still tied in to the platform, or you're likely not doing too much.
Sure you can emulate a declarative view on top of a mutable thing (Think React and virtualdom), but having a declarative core makes declarative deployments easier to manage and more elegant.
E.g. in Kubernetes automatically deleting a resource is still hard; It's hard to figure out when something is not "used" anymore.
In nix, you simply run `nix garbage-collect` and all the things that are not referenced by your declaration are automatically deleted.
NixOps is a great tool..when it works. When it doesn't, it's not inherent. It's just that it is clearly not heavily invested in by any entity with a bunch of money.
---
My problem with Kubernetes is people adopt it without understanding it. They adopt it because everyone else is without ever asking, "Why?"
I've installed and managed a simple K8s cluster before now and it was a nightmare (this was only a year ago.) It wasn't until we moved the management of the cluster to a managed service that it became worth it. It was at THAT point it was worth containerising the application(s) (another complexity to overcome) and letting K8s handle the deployment and scaling.
I'm worried that as an engineering culture we're not pushing back enough and saying, "Yeah K8s is cool but look: do you really need it? It's very likely you don't". For me to automatically recommend K8s to my clients I'd need to see a (near) zero friction deployment options that's fully feature compliant and truely fully managed. It's at that point I would be happy to say, "Sure! Let's go with K8s and just write YAML files to deploy our containers!"
(And then there's the whole debate as to whether or not you even need a container around your monolith... probably not. Then the next debate about people starting out with microservices when we all know that's not a good idea.)
---
My problem with Kubernetes is people adopt it without understanding it. They adopt it because everyone else is without ever asking, "Why?"
I've installed and managed a simple K8s cluster before now and it was a nightmare (this was only a year ago.) It wasn't until we moved the management of the cluster to a managed service that it became worth it. It was at THAT point it was worth containerising the application(s) (another complexity to overcome) and letting K8s handle the deployment and scaling.
I'm worried that as an engineering culture we're not pushing back enough and saying, "Yeah K8s is cool but look: do you really need it? It's very likely you don't". For me to automatically recommend K8s to my clients I'd need to see a (near) zero friction deployment options that's fully feature compliant and truely fully managed. It's at that point I would be happy to say, "Sure! Let's go with K8s and just write YAML files to deploy our containers!"
(And then there's the whole debate as to whether or not you even need a container around your monolith... probably not. Then the next debate about people starting out with microservices when we all know that's not a good idea.)
It downloads, installs, configures, builds and runs from your declarative description. This is my understanding of how nix works anyway.
sign me up
ORDER BY tweet.time DESC
would result in a impractical experience for a site that has millions of DAU.Also, it's just a very premature optimization in a world where CLUSTERED INDEXes exist. The database engine doesn't have to cluster by primary key, it can cluster directly by time (or any other index) if you ask it to. The power of doing it that way is that you can flexibly change it based on real performance issues (how do your execution plans look?) and characteristics (are you read heavy or write heavy? which ones are your bottle necks?), whereas if your application makes assumptions about ID format it's a lot harder to on-the-fly tune queries that all need to be rewritten.
Best I can come up with is it'd make promoted comment more apparent?
For example, if someone follows two people and one person simply tweets at 1000x the rate of the other, I would argue that it would be better UX if the rare tweet from the other person gets more weight.
Another thing Twitter does is show you popular things that have been liked by the people you follow. It might be way too much to show you every thing that every person you follow has liked every time. But it can introduce some interesting content to your stream to see such second-tier content.
I don't see how promoted content plays into it since you can interpolate it anywhere.
But yeah, I wish a simple timeline was the default, and twitter stopped switching away from it.
It has that and more!
Open source - https://github.com/kgthegreat/sensible
It's fair to argue auth should be included in a nontrivial example though. I honestly don't think it would add that much clutter either. Although unlike the other components, I don't know if there's a simple off-the-shelf Haskell solution for auth.
Easier to work with -> fewer people needed -> fewer people hired -> fewer people learn -> fewer people know.
Now there's fewer people in the market who know Simple, vs many people who've learned OverEngineered (TM). Leadership wants to pick a language/style they'll be able to hire for as-needed. OverEngineered has a much larger talent pool.
import Database.PostgreSQL.Simple.SqlQQ (sql)
...
let index :: Handler Markup
index = do
tweets <- query_ [sql|
SELECT "user".name, tweet.contents
FROM "user"
INNER JOIN user_tweet ON "user".name = user_tweet."user"
INNER JOIN tweet ON user_tweet.tweet = tweet.id
ORDER BY tweet.time DESC
|]- there are fifteen LANGUAGE directives (what do they all bring?)
- there's an ungodly amount of ASCII-art: What do any of these do, and in which contexts: ! @ :> :<|>
And so on: just three things that caught my eyes looking at the code on my phone
Servant (the routing library being used here) has pretty great and clean authentication support. https://docs.servant.dev/en/stable/tutorial/Authentication.h...
As for validation of input, what do you mean? Haskell tends to excel there as well, with the availability of parser combinator libraries like Attoparsec.
> LANGUAGE directives (what do they all bring?)
In a real project you hide these in a config file for your project. They're usually well documented, and you can usually guess what they're doing from the name once you have some context.
> What do any of these do, and in which contexts: ! @ :> :<|>
All of those except @ are just functions or types. You can look up what they do in the same way you would look up what any other function does. @ is the only one that's a syntactic operator, and it has 2 meanings depending on context. It's either specifying what a type variable should be, or it's pattern matching and binding a name at the same time.
1 - https://github.com/dom96/nim-in-action-code/tree/master/Chap...
https://github.com/gothinkster/realworld
It's pretty easy to tell which frameworks are mature and which are not simply by looking at how many wheels that need to be reinvented.
Laravel, for instance, has so many really nice wheels, but it's organization can feel restrictive at times.
web.py, on the other hand, has basically no wheels but I can drop into a project really quick.
Maturity is a spectrum, and sometimes you don't need a wagon when a bike will do.
It would be awesome if Nix, NixOS and NixOps replaced the current mess that is Docker and K8s.