Linked by Thom Holwerda on Sat 11th May 2013 21:41 UTC
Windows "Windows is indeed slower than other operating systems in many scenarios, and the gap is worsening." That's one way to start an insider explanation of why Windows' performance isn't up to snuff. Written by someone who actually contributes code to the Windows NT kernel, the comment on Hacker News, later deleted but reposted with permission on Marc Bevand's blog, paints a very dreary picture of the state of Windows development. The root issue? Think of how Linux is developed, and you'll know the answer.
Thread beginning with comment 561658
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[17]: Too funny
by Alfman on Wed 15th May 2013 15:18 UTC in reply to "RE[16]: Too funny"
Alfman
Member since:
2011-01-28

satsujunka,

"I guess, but in the case of a log this isn't really going to be an issue. And this also depends on whether or not reading incomplete transactions is an issue."

We seem to keep floating between two separate topics here 1) logging, and 2) implementing a generic sql database using a text engine. I think I've made clear why implementing a full SQL database over text is more trouble than it's worth. I think you've made clear that it could nevertheless work for logging since it's append only. Personally I wouldn't see the point in using a special kind of database just for logs, but I'm not denying that it could be done.


Regarding NULL DB engines:
"This would be fine. The logs are in text and you can use SQL. That fits my requirements just fine."

This would be my preferred solution.


"This is actually what I've been saying. The log should be structured in record format. CSV is a record format so that was the example I've been using (it has the added bonus of working with existing tools, but so long as the format can be read by humans I don't care.) The only additional requirement I have is that the record format should also be human readable."

This is not what I meant. For one thing, CSV's data escaping rules are non-trivial and require a state machine generate & parse CSV character by character. Very often I've seen CSV data feeds output by trivial means that don't even escape the data fields at all. Sometimes this problem is not noticed until someone enters a comma on a production machine causing fields to become misaligned. More importantly though, CSV would be a poor choice because records don't contain field metadata, the reader has to be programmed with some template to just know what each column means. This ambiguity is unacceptable when we try to insert records into the database. So XML would technically be better, but this isn't what I meant either.

I think all programs should be using a structured library interface directly without bothering with the text conversion at all. It could be a library call similar to printf, but it would have to be capable of maintaining field metadata. This call would not output text (optionally it could for interactive debugging), instead it would transmit the log record to the system logger.

You, as the administrator, could setup the system logger to take in the *structured data* and do whatever you please with it. You could output text files (whether csv, xml, yaml, json, or whatever suits your fancy), you could record the records in the database of your choosing, you could filter/throw them out without logging, you could even have special triggers to perform various actions as things are happening. This could be highly efficient as there isn't a need to convert integers to text and back again or scan text values of unknown length as is necessary with a text format.

As a programer trying to integrate subsystems, I find this far more appealing than having daemons write out text logs and then programming monitoring scripts to parse text logs back into a structural form before being able to do something useful with them. The goal would be for all programs to build on top of interfaces which enable a higher degree of data abstractions. The lowest common denominator would get raised to a datatuple instead of a line of text as it stands today.




This is getting long winded, but since it's relevant: I was actually discussing this topic with Neolander. The vision was not just for logging, but actually to replace all sorts of text I/O streams with data tupples. When I do "route -n" or "iptables -L", the programs could open a datatuple output stream instead of (or in addition to) a text output stream. Bash could be modified to support these structured data output streams and work with them.

Some examples:
iptables -L # dump human output to console.
iptables -L | spreadsheet # open tuples in spreadsheet
iptables -L | gencsv > file.csv # save tupples as csv
iptables -L | genxml > file.xml # save tupples as xml
iptables -L | genjson > file.json # ...
parsexml file.xml | genjson > file.json

iptables -L | mysqlinsert database.datatable # insert tupples into database



Note that in these examples, iptables doesn't care how the structured data gets used, and the receiving tools don't care what is producing the data. Unlike today, no parsing would be needed. This would all be possible if we could get away from text as the least common denominator and transition to data tuple based IO. (This is why I said it's best not to think in terms of "text" versus "binary", but in terms of data abstractions)


I find these ideas very inspirational and extremely compelling, but I'm not sure if there's any chance of convincing existing mainstream operating systems to change their way of doing things. If I were still working on my own OS I would certainly do it this way.

Reply Parent Score: 2

RE[18]: Too funny
by satsujinka on Wed 15th May 2013 22:09 in reply to "RE[17]: Too funny"
satsujinka Member since:
2010-03-11

Okay, so moving out of the logging topic to databases in general as a organizational system for an operating system.

About CSV vs. XML: Considering Golang's csv and xml packages: both of the 2 go files for CSV have a combined size smaller than xml's 3 of the 4 go files for xml (the 4th is approximately the same size as csv's reader.go). To me this implies that CSV doesn't have any escaping issues that are particularly harder to solve then XML or JSON (JSON actually has the most code dedicated to it.)

Of course, part of this is that csv provides the smallest feature set. However, comparing similar functionality leads to the same conclusion.

As for metadata: you have to provide a schema no matter what data format you choose. XML isn't better in this regard; usually you match tag to column name. CSV has a similar rule: match on column position. I know in relational theory the columns are unordered; but in practice the columns are created/displayed with an order; just use that. Optionally, you can write a schema to do the matching. This is actually a better situation then XML which requires a schema all the time (what do we do with nesting? I can think of 3 reasonable behaviors off the top of my head.)

---

I think all programs should be using a structured library interface directly without bothering with the text conversion at all. It could be a library call similar to printf, but it would have to be capable of maintaining field metadata. This call would not output text (optionally it could for interactive debugging), instead it would transmit the log record to the system logger.

I'm not opposed to this in principle. However, I fear figuring out what this "printf"'s interface should be will not be so simple. Does it expect meta-data co-mingled with data? Does it take a schema as a parameter? Isn't "%s:%d" a schema already (one whose fields are anonymous, but paired with scanf, you can write and retrieve records with it)? Also, what should we use for a schema format? Or should we just choose to support as many as possible?

The vision was not just for logging, but actually to replace all sorts of text I/O streams with data tupples.

What would these data tuples look like? You'll need some data to mark where these tuples begin and end, their fields, and their relation. End can double as begin, so only 3 symbols are necessary (but the smallest binary that can hold 3 is 2 bits so you may as well use 4.) If you omit table separators, then you need to include a relation field.

With 4 symbols:
Bin Txt Description
00 - ( - tuple start
01 - , - field break
10 - ) - tuple end
11 - ; - table end

Ex.
(Id,First Name,Last Name)(001,John,Doe)(002,Mary,Jane);

With 3 symbols:
00 - , - field break
01 - \n - tuple end
10 - \d - table end

Ex.
Id,First Name,Last Name
001,John,Doe
002,Mary,Jane
\d
... Hey, wait a minute that's CSV! ;)

With 2 symbols:
0 - , - field break
1 - ; - tuple break

Ex.
Person,Id,First Name,Last Name;
Person,001,John,Doe;
Person,001,Mary,Jane;

Just to make it clear: I too want a standard format that everything uses. It's just that saying "use tuples" ignores the fact that we still have to parse information out of our inputs in order to do anything. You do go on to say "redesign bash to handle this". I assume you also mean "provide a library that has multiplexed stdin/stdout" as you also have to write and read from an arbitrary number of stdin/stdouts (as corresponds to the number of fields.) Alternately, you could shift to use a byte code powered shell (so that all programs use the same representations as the shell and can simply copy their memory structures to the shell.)

Reply Parent Score: 2

RE[19]: Too funny
by Alfman on Thu 16th May 2013 00:57 in reply to "RE[18]: Too funny"
Alfman Member since:
2011-01-28

satsujinka,

"About CSV vs. XML: Considering Golang's csv and xml packages: both of the 2 go files for CSV have a combined size smaller than xml's 3 of the 4 go files for xml (the 4th is approximately the same size as csv's reader.go). To me this implies that CSV doesn't have any escaping issues that are particularly harder to solve then XML or JSON (JSON actually has the most code dedicated to it.)"

This methodology really isn't sound, but I don't really want to get into it.


"As for metadata: you have to provide a schema no matter what data format you choose. XML isn't better in this regard; usually you match tag to column name. CSV has a similar rule: match on column position."

XML provides self-defining metadata (the names and possibly other attributes), where as CSV does not. It's illogical to me for you to disagree, but let's just move on.


"However, I fear figuring out what this 'printf's interface should be will not be so simple."

It doesn't really matter for the purpose of this discussion, whatever makes it easiest in the context of the language the library is being written for.


"What would these data tuples look like? You'll need some data to mark where these tuples begin and end, their fields, and their relation. End can double as begin, so only 3 symbols are necessary (but the smallest binary that can hold 3 is 2 bits so you may as well use 4.) If you omit table separators, then you need to include a relation field."

Your still thinking in terms of text with delimitors, but the whole idea behind the tuples would be to use a higher level abstraction. Think about how a class implements an interface, you don't have to know how a class is implemented to use the interface.


"It's just that saying 'use tuples' ignores the fact that we still have to parse information out of our inputs in order to do anything."

No, you as a programmer would be using the higher level abstraction of the tupple without caring about the mechanics used to implement them. You keep thinking in terms of programs parsing text streams, but with the tupple abstraction you can skip the intermediary text conversions entirely. You only need code to convert the tupple to text at the point where text is the desired form of output like in the shell or a logfile. I'm not sure your understanding this point.

Reply Parent Score: 2