Hacker News new | ask | show | jobs
by keymone 3360 days ago
Calling it. Nginx won because it's configs are not xml. Apache should have learned by now.
8 comments

Apache doesn't use XML, its configs actually predate XML.

Yes, Apache configs are confusing, but it's not due to them being in a HTML-like style, and I suspect same thing would happen even if they had similar syntax Nginx.

IMO the problem is that Apache is extremely modular and every little piece was split into a separate module. There are many modules that are pretty much essential. It doesn't help that the example Apache config then comes with many not essential modules enabled.

One time I was motivated to just have Apache run only things that are necessary. I started without any modules and each time config complained that something is missing, I read documentation about it and either enabled it, or removed from the config. It took me quite a while. And I know people (in fact that is a vast majority) who would never bother to do that. Because of that Nginx looks attractive out of the box, because by default you don't need any modules to have a basic server.

Similarly this is also the reason why people also moved from Sendmail to Postfix. Sendmail doesn't use XML but it also has a steeper learning curve to correctly configure it.

Apache configs are not XML files, they just happen to contain some square brackets.
<Angle> brackets. [These are square]

And Apache config predates XML. It was designed to look like HTML, because it's a webserver I guess.

Why all the hate against XML, especially when used for configuration? Having a schema configured is a plus.
XML for configs is fine, as long as you treat it as a binary format. Which means having tools to help manage those configs. Too many people use XML for configs and then call it done, which makes for a terrible experience.

XML with config helpers and the ability to open it in an editor and see what is going on and tweak it is a great experience. XML with the expectation that an editor will be used to configure it is a terrible experience.

The above also applies if you replace "XML" with "JSON". :-)

Nginx configs are still terrible because the documentation is not good.
Aren't Apache configs something unique that has pieces that look like XML but actually aren't?
No, it's just sections defined by <> looking things and then key, complex value pairs
What's wrong with XML?
Apache wasn't a competition, lighttpd was.
XML should NEVER be used for configuration, not even if you're a Java or C# framework/middleware/application server.
It's not xml!!!!

There's just opening and closing tags for a stanza. Look at a basic virtualhost config.

I know that one of the reasons that Apple went with XML for launchd was that you can define an XML schema for the files and validate them against that schema. IIRC, this claim was made in a HN (or Slashdot) discussion maybe 5 or 6 years ago.
Honestly, I think the statement, 'XML should NEVER be used, period,' is true as well: for any use case I can imagine there are superior alternatives to XML. Even if you have to interface with other services using XML, just use SXML (https://en.wikipedia.org/wiki/SXML) in your own code and marshal to XML at the very last instant.

Ultimately, XML was a colossal mistake carried out to perfection.

SGML and XML were invented as a meta-language for encoding semistructured text such as HTML with plain text editor programs, and excels in that use case like nothing else. That XML is abused as config language, payload meta-syntax for web services, for encoding component models, and even as meta-syntax for programming languages is hardly SGML/XML's fault.
I've never seen SXML before, but that looks way worse. All of Lisp's frustration of trying to match closing parens with none of Lisp's power.
As opposed to closing tags? All decent text editors have matching parens highlighting.

SXML is much easier to parse and it's more concise.

HTML itself allows SGML-style tag omission since HTML was originally an application of SGML. A simple example can be found at [1], and can also be seen in action in my talk slides linked from [2].

[1] http://sgmljs.net/docs/html5.html#tag-omission-on-document-l...

[2] http://sgmljs.net/blog/blog1701.html

We're talking XML rather than HTML (and omitting certain closing tags isn't compliant HTML5 anyway).

In XML there's also the concept of using self-closing tags only for "empty tags". Meaning, <tagname val="123"/> isn't "correct" and <tagname>123</tagname> should be used instead; while s-expressions simplify this.

More like _humans_ shouldn't edit XML by hands, XML has it's strong points as a machine-friendly format.
Such as? At that point might as well just use a slimmer binary format without so horribly complicated parsing rules.
It hard to take a hardline stance on something with so much give and take.

XML is great because there are plenty of fast parsers for it with bindings in pretty every programming. It can be modified with nothing more than a text editor, by someone halfway competent.

XML is bad because it will never be quite as optimal as some binary only solution and editing with a test editor is painful.

Its not like most programming languages would have a hard time with gzipped xml either. This grants most of the benefits of binary formats and is often smaller than all but the most carefully designed ones.

All of that even presumes config load time matters. I a crazy large case maybe 10MB loads from a disk and the important stuff is cached in memory, in the actual structures that will use the data later. It just doesn't matter. Gzipped xml is fast enough for realtime high performance games, who cares about this silly XML hating anymore. Just pick something that works and move on.

Why not?