Non-technical article about technical articles

They often tell me - hey, where are the technical articles? Why are you writing all sorts of rubbish about managers, directors, relations with staff, corporate squabbles, whining about the meaninglessness of our work and in general. We want technical articles!

I honestly don’t understand what “technical articles” are. I understand what a “task” is and what a “solution” is. I also understand that the solution to the same problem can be found at different levels - from "iron" to philosophical. Which level is more correct - I don’t know.

To understand, you need your help. I have a great end-to-end example of solving one problem at a different level. I warn you right away - an example from the sphere of 1C, but your beautiful brains will have a place to apply. Let's try to find a place for a "technical article" in this chain.

An example is a collective of several real stories. I mean, it was repeated several times, with different actors, turning on / off different stages, but the essence is the same. Chased.

initial situation


The initial situation is simple: the calculation of the cost of 1C does not complete.

For those who are far from the yellow world, I will explain. Costing is approximately the most resource-intensive operation that happens in 1C. It is carried out at the end of the month, sometimes it, in the old manner, is called the "closing of the month."

Within a month, the so-called "Primary documents" - the receipt of materials, transfers between warehouses, product releases, write-offs from the warehouse to production, adjustments, receipt of costs, distribution, assembly, etc.

The essence of all documents is the same: something is flowing somewhere. From warehouse to warehouse, from warehouse to production, from production to warehouse, from one workshop to another, from one nomenclature to another. Roughly speaking, there is a change in the state of inventories and costs. There was nothing - it became material. There was material - it became a cost. It was a cost - it became a product. Was production - became material again. Was products - became revenue. It was electricity - it became a cost. It was a cost - included in the cost of production. Just a change in the state of the essence, if you abstractly reason.

The whole thing is recorded within one month in one large table, which is then processed by the cost calculation. He has two key tasks - to allocate costs and adjust costs. Distribute costs - it’s like to include in the cost of production everything that was spent on this issue, such as materials, electricity, salaries, etc. (before calculating the cost, these were different table entries, release separately, costs separately). Well, to adjust the cost is to decide SLAE to bring the cost to the desired write-off strategy (average or FIFO).

So, suppose all this crap doesn't work. We start, wait a day, then it falls. It is known that the calculation is performed on a server running Windows Server 2012, in one process rphost.exe, DBMS - MS SQL.

Environment level


The first level is purely patsansky. We don’t want to know anything about any 1C, we look only at the environment. What, in general, does it matter to us what this unfortunate 1C does there? We already know that she does everything wrong, but somehow we can do without the snotty.

The field for experimentation is huge. As well as material for real, without quotes, technical articles.

Let's start with the choice of server hardware. After all, he was probably picked up by 1Sniks, who do not petrify in this. We will write about the effect of RAM on the performance of heavy 1C operations, examine hard drives of different physical designs, see what is more important - the number of processors or cores. In real practice, we will also order a new server. Especially given the rollbacks that server providers pay.

Next, let's look at the OS. It’s not good to keep decent servers under Windows? Moreover, 1C has long been able to work under Linux. And, finally, clustering is supported in 1C, and we, formally, can supply two or more servers, even under different operating systems. Here will be a mother for the article.

Well and, of course, we will not bypass a DBMS. Why the hell did everyone run into this MS SQL? At least, let's look at Postgre, which 1C has been supporting for about 100 years. Even under Windows. Not only will we try another DBMS, we will also adjust it so that the noise is standing. True, a lot of articles have already been written on this topic, including 1C company itself, but we will certainly find what to say in our technical article. After all, it is interesting to read people's experiences, not manuals.

Will we solve the problem? Not excluded. Practice shows that quite a lot of problems are solved at this level - especially, when problems with the calculation of cost, the first occurrence, i.e. at that time, when all the settings of both the OS and the DBMS were defaulted.

But our story is a little different. All possibilities have already been exhausted, the best minds of the city poked around in the server - moreover, bought three months ago. Then, immediately after the launch, the server broke the cost calculation in just 16 hours. And now, alas, for some reason, and for a day can not cope.

Have to go up a level.

Level 1C


Okay, drop the iron, climb to the program. A simple performance measurement shows that 1C freezes and crashes when performing a cost allocation operation.

There, in fact, everything is simple. There is a table in which at the time of calculating 8 million records. Roughly speaking, half of them are costs, the second half is the distribution base. Those. you need to take the first half, and rush to the second.

We sit and think - where is there to fall, darling? Banal search, albeit accompanied by constant queries to the database with storing intermediate results in temporary tables. Well, maybe the problem is that the result cannot be recorded, i.e. add as many to 8 million records.

Nothing complicated, but falling. The rphost.exe process is missing something. So, stop ... And why is such a simple, and, in general, not particularly context-sensitive operation, a single process? Who prevents to divide the table in half, or even into three parts, and execute in parallel? After all, 1C is quite capable of starting at least 20 processes, but for some reason it does not. So why not? Or does?

Yeah, we find that our version of 1C is a little outdated, and in more modern parallelization is made directly to the settings - a person can tell in advance how many parallel threads of these very “calculations” can be performed. Mess!

We add a simple code that cuts the table into the required number of parts and executes them in parallel. Let me remind you that the distribution of some costs does not depend on the distribution of others, in the framework of one iteration.

Yo! Earned! Failed calculation of the cost! Sometimes, however, there are locks for writing - do not care, we attach a patch in the form of a cache of records with a controlled lock for subsequent placement in the main table. The beauty! Works!

U, how many articles can be written here! Technical! True, with a little yellow color. Although, on the other hand, where ours did not disappear? What, in your development environment and on your projects didn’t have to divide the record of millions of lines into pieces so that the DBMS would not die?

Everything, a victory, it seems. But something is gnawing ... The cost was calculated, but still - too long. The same day, it just stopped falling - the volume of records has not gone away, we just write them in pieces, pseudo-in parallel.

Crawl higher.

Level of technical setting 1C


Analyzing the algorithm, we understand that the problem is not only in the number of records, but also in their multiple processing. Theoretically, we understand that to distribute 4 million records to another 4 million, it is enough to fulfill a query in which to match the rows by the necessary analysts, and then record the result.

And here we look - hell, and there is a cycle ... A cycle that runs according to a table of 4 million rows. And there is another cycle in it, with an unconditional interruption according to some strange condition. And the body of the nested loop executes much more than 4 million times. Pancake…

Poking around, we find the third table, which stores the distribution settings. Roughly speaking, there lies the comparison of the first 4 million records with the second. But everything is organized there not unambiguously, but with a gradual narrowing of the filter. At first it was written like “all costs with a view of General production figuratively stupid for release”, then “But this article is also for release”, then “but this article is sweat for this division is also for release”, then it is specified to the nomenclature group, accounts accounting, etc.

The worst thing is that the algorithm does not determine the distribution setting in one pass, but does it cyclically, gradually approaching the goal. Despite the fact that the result is, in the end, the same. And, no, this is not the worst thing - there are 10 thousand records in this table. Explicitly driven by hands.

We recall how accountants work with these settings. Programmers have driven 4 rows into the table, with the widest filter. And the accountants had something “not closed” - they stopped by and specified a filter for a specific article and a specific department. And so they did 10 thousand times, over the years.

As a result, our 4 million records run through the other 4 million records several times. Well, we roll for courage and go to the accounting department. Not to the chief accountant - she is probably not in the know about this setting. Let's start with the deputy chief.

We come, explain the meaning of this tuning table, and tell (again) how to use it. We are convinced that everything will be fine. We set up a test base, conduct an experiment, after having beaten up 10 thousand records, and voila - the calculation of the cost took only 8 hours!

Uh, gay! What a cool article you can write now! Will it be technical only? Well, I don’t know ... For certain, yellow communities, probably yes. Okay, let it be technical and methodological. At the same time, add a couple of paragraphs about what stupid accountants.

And here comes the thought - since I managed to break into accounting, maybe something else to pick? For example, to understand why there are 8 million entries in the table. And most importantly, why there are more and more of them every month.

We are trying to rise a level higher.

Accounting level


It is clear to us programmers that the number of rows in a table is determined by the width of the analytics used, and not by the volume of output. Moreover, we know that the output of a native enterprise, like its product line, is growing much slower than the size of our table.

For example, if our division was the only analytics of the issue, then the number of rows in the table would not be more than 2 * the number of different divisions (half for release, half for costs). These divisions are with us, God forbid, a hundred.

If we add, for example, the analytics “Cost item”, then the number of records will be (Number of units) * (Number of articles) + (Number of units), because the second half of the table (release) does not contain article analytics (as a rule, if there is no transfer semi-finished product from unit to unit without the use of a warehouse). The worst thing in this equation is *, i.e. multiplication. 100 divisions and 100 articles - already 10 thousand records.

Then we multiply by the number of nomenclatures, characteristics, orders for production, nomenclature groups, damn me ... So it’s gaining 8 million.

Or not gaining? We recount on the calculator - no, not a fig. More precisely, even without a calculator it is clear that the number of records should not grow so quickly, from month to month.

We expand the report on balances in the context of all the analysts used, and - bah! - Well it, dog, stupidly does not close! Let me explain what it means to "close" - this is when the analyst’s recruitment balance came, and at the end of the month he left. But it doesn’t close - when it hasn’t left. Thus, work in progress is formed, in other words, work in progress.

And it doesn’t close exactly according to one analytics - an order for production. For each batch of products, a certain document is set up that separates this batch of type from the rest. Costs are sent to it (first half of the table), output is reflected on it (second half of the table), and everything should be closed. But it does not close.

Deputy the chief accountant, who is sitting nearby, is also in shock. I didn’t know that it wasn’t closing - that’s ahtung! Poking around, finding out - they, accountants, just look at the reports without taking into account orders. Everything is closed without this analytics, but not with it.

And these ponytails - unclosed amounts for production orders - are also included in 8 million lines, these are the incoming balances of the beginning of the month that must be closed in the current month (in principle, this happens if the production lasts several months, but it doesn’t our case). The problem is that they cannot be closed with us, because there will no longer be any release on orders of the last month, and the costs are compelled to eke out a miserable existence for another 1 million years, constantly increasing the number of entries in the distribution table.

We run to our test base, remove all the tails, and - eat your leg! - records in the calculation becomes 1 million! Calculation already fits in 2 hours!

And we already have the enthusiasm of a researcher - after all, such material for a technical article is pecking! We removed the tails, and this month the order analytics is still present. Okay, Che, the test base - we cut orders in general, and the table collapses to 400 thousand records.

The calculation is 1 hour. 1 hour, Karl! We have reduced the calculation time by 24 times! Well now we’ll write a tachen article, almost technical, that you’ll download!

True, it remains to explain to the chief accountant that the order analytics is superfluous. We roll also crawl to the second floor.

Accounting Strategy Level


We console ourselves with the hope that everything will go off with a bang. In the end, we have solved the problem of calculating the cost of production - and how! We assume that the chief accountant is not aware at all about the settings for the calculation details, and someone just once included the order analytics, let it be like that.

But no. As soon as the chief accountant heard "turn off the order analytics", she was completely enraged. I began to drive about the awesome need for the company to have a complete picture of the cost of production, and, most importantly, to compare the numbers precisely in the context of orders, within one counterparty, and monthly.

We gather a full chest of air and ask the main question: is this, Marivanna, have you ever done such an analysis? Of your own free will, or by order of other units?

Well, for a few minutes we listen to a variety of adjectives and nouns, mainly derived from just four words of the great and powerful. Mentally recall the addresses of sites with vacancies. But we decide to go to the end.

We are not letting the chief accountant finish, we are saying that this is all fine, but I want to find the source of this demand. The chief accountant freaks out and sends to the financial director, who is her boss, and economists.

Those guys are simpler, and the alcohol in the blood is already enough to chat with them. While we are going, we are thinking - what can you write about this adventure? Nothing technical, obviously. Although the problem is visible to the naked eye. Well i.e. it is clear that at all levels below we were solving a nonexistent problem.

Corporate Game Level


And finder is our friend. We helped a lot with this fun aunt with automation. Therefore, we ask in the forehead - what for accounting keeps records with such a wide analytics? Yes, so shitty.

My aunt immediately clings to the word “shitty” - what is shitty, where is shitty, is it really shitty? Well, yes, we say shitty, really shitty. Because of it, the IT department does not sleep for a bunch of nights, scribbles a bunch of technical articles and generally burns out.

Aunt takes the bull by the horns and asks to state everything in writing - what is wrong, why and how I got to this. Okay, we promise to state it. But, again, we go to the end. What, we say, the chief accountant is engaged in such garbage, moreover, under the guise of a finder, i.e. are you aunt

We get an answer in the forehead - and let it torment you, reptile. Nefig was smart at meetings. Saying that there is nothing more important than accounting. To assert that it is wrong to subordinate the chief accountant to finder. To carry nonsense about the fact that the chief accountant is the second person in the enterprise, after the director.

And why, say, just do not fire her? But you can’t, aunt says. Well it will look like the elimination of objectionable - like, my aunt blundered, and immediately flew out of work. An unpleasant bell will be for the director. It will begin to delve into how anyone keeps records.

And now - an oil painting. The chief accountant does not cope with accounting. Put the base on its side. So if it weren’t useful for business, I wouldn’t organize a normal cost accounting for orders.

In between, we ask - and you, aunt, what for this accounting for orders, and even in accounting? He answers in the forehead - he didn’t dig at me anywhere. Neither economists nor financiers use accounting figures. Only primary documents.

Uh, say so? And where do you get the cost price from? Well, you can’t count the profit without it.

Sami, says, we consider the cost. Using the cash method, we collect material costs at purchase prices, and distribute them in exel, using the boiler method, using material consumption rates, adjusted to the fact only by amounts.

Because, my dear, our task in terms of cost is to give the director a sheet of A4 format called “Profit and Loss Statement”, where all costs are divided into ten groups that are poorly correlated with cost accounting items.

Roughly speaking, everything that accounting does is not necessary for anyone except accounting. And accounting, cost accounting is needed in a very short analytics - even the one that is present in the accounts of accounting. And there, God forbid, if three analysts are typed.

We leave the finder’s office in mixed feelings. On the one hand, it seems, they figured out everything - there is no need to solve the problem at all, and the problem of calculating the cost price will disappear forever. On the other hand, they were drawn into corporate games.

Now how. You will write a piece of paper about the chief accountant - you will become an enemy to them forever. If you don’t write, you’ll lose friendship with the finder, and you won’t get along with the deaf. She wouldn’t believe it, if you told a story like “I was asked to drip on you, but I refused.”

And there’s nothing to write a technical article about. Generally. Although, you already understand that to solve all problems at the lower levels is not that it is useless - it is harmful. After all, all the effort and money (remember the recently purchased new server?) Did not go to the benefit of the company, but to the benefit of one aunt who is friends against another.

The mood is filthy, and then the director catches my eye. More precisely, we catch his eye. The guy is well-worn, sees a bad mood, and immediately calls to his office.

We rise to a higher level.

Bird level


We decide to tell everything. From top to bottom, without embellishment. About everyone. There is nothing to lose.

And about the server for 1 million rubles, which is now not needed. And about the bloated staff of accountants, which is needed to maintain such a complex accounting, which, as it turned out, no one needs. And about the bloated staff of programmers, which is needed only to accompany moronic accounting. And about aunt-finder, who plays her games at the expense of the company.

The director listens attentively, sometimes asking questions of both technical and methodological nature. He straightly pervades like that, on the fly he realizes that he once worked as a programmer.

And he writes all the numbers on a piece of paper.

We pour out the whole soul of the programmer. About the fact that we were born to solve technical problems, and not to participate in corporate games. About the fact that the technical level of the solution should be the last when all other methods have been exhausted - organizational, methodological, strategic and what else are there. About creative nature, abstract thinking, introverts and other programming tales.

And on the way, we think what a cool article would be. Just not technical. And where to place it? Also a problem. Pretend in an article that everything was decided at a technical level, and limited to it? But it’s not true. But if you say that you have reached the director, they won’t believe it. The programmer's place at the factory is near the bucket, excuse me.

The director politely listens to the end, then draws a line under his numbers, and gives: buddy, you have revealed a problem that costs me 1 million rubles a month. Thank you very much. Right like that, without an exclamation mark.

Now, he says, it will be so. We start the project of bringing accounting into order. You will be the leader. I’m firing CIOs, you are taking his place. I will instruct the security service to check whether he received kickbacks for the purchase of equipment.

I look forward to a clear plan for accounting, and accounting, and management. So that everything is beautiful and interconnected, but only in the right analytics. You will implement this plan. Any changes in accounting will now be implemented only after your approval.

In terms of accounting should be the calculation of the required number of specialists. Extra - we’ll fire without smearing snot. Immediately think about how you can automate the activities of the remaining ones - perhaps there are too many of them, if you approach wisely.

Don’t get arrogant, man. You are working for me now. You will be my eyes and my technical brain. No games - not with me, nor with anyone else.

We leave, on staggering legs, and crawl into our basement. The head is spinning - either from happiness, or from fear. I want to escape, as if from a strange dream, just to return to my usual reality. Is it really so?

No, it doesn’t. They won’t believe it. And you won’t write an article about it. They will peck, peck and send articles to Cosmopolitan to write about IT Cinderella. And he would not have believed it. More precisely, I would say that I do not believe, if only I would not admit that I am afraid to get out of my hole and ask, “should I fuck this bullshit?” Although at a brilliant technical level.

Actually, the question


Where is the technical level here? What is interesting and useful about writing and reading technical articles? Here is a direct example.

All Articles