The foundation .NetCore

.NetCore several major features

    This article from the open source comprehensive .NetCore, dependency injection, including the introduction of cross-platform, features of the application server to start. It takes about 10 minutes reading time.

 

The difference between .Net

    In .Net and .NetCore on writing code is not much difference, you use C # as the programming language. Mainly embrace more open source in .NetCore, with the world's common development.

 

The importance of open source

    Framework for general corporate use of open source. Open source framework can bring improvement in our efficiency, without wasting more time to deal with the underlying allow more time to reach business.

    .net core has a comprehensive open-source, Microsoft has gradually oriented open source. Which is not a popular open source framework? The front bigwigs Angular, React, Vue which is not open source.

    Say why Microsoft to open source? Microsoft has been addicted to closed-source bee. This is related to their leader, which is Microsoft .NET reason for this has been the decline. The turning point in Microsoft's new CEO Satya Nadella, he wants to drive the ship of Microsoft software.

 

Injection & dependency inversion of control

    I believe many people know how dependency injection. Here mainly talk about the .net core of dependency injection and inversion of control.

    Written before the main reference article

1) lying DI DI + IOC inversion of control (a) of the definition of

2) lying DI DI + Analysis .Net Core IOC control inversion (two) of the IOC and DI

 

Package introduced

    In .net, the package references seem obvious level ① ② do not know the details depend on this package ③ multi-project dependencies can easily lead package dependencies.

    And after the .net core out, the first solution is to package and display dependency problems. Package depends .net core appears to be infinitely extended until there is no dependency. The problem is easily able to see the package, as well as to avoid the two-way dependency problems.

    In fact, the package introduced in .net core, the only solve the problem of the display. The whole package, at compile time or at the same level all the dll folder. Hope in the future, after the code is compiled, it can be done in different folders in different packages so that can better distinguish.

 

Cross-platform

Why .net core was born? In fact, Microsoft's cross-platform launch for the .net core. .Net core cross-platform is the most important characteristic. .net core can easily run on any platform. Of course, .net can also run on linux by mono, but a lot of trouble, it may report a variety of natural mistake, supporting poor. But the .net core cross-platform zero cost.

Across platforms, .net core encapsulates the underlying, can be compiled into a specific code to run on linux.

 

application server

    As we all know, why .net core can run on linux? The maximum benefit Kertrel server. If not Kertrel, is not up and running a web application. iis Of course not, it is a natural bloated and only supports windows system.

    According to performance tests, Kertrel is about 2-5 times iis server performance.

 

Brief kestrel

    kestrel is a lightweight web server. Because light weight, it is generally not directly provide services. Typically deployed in nginx, traefix, behind iis. The following is a Microsoft official figure:

    If the request is an internal network, it can be used directly Kestrel:

clipboard1

 

    If the public network, the proposed anti-generations behind nginx, iis and so on:

clipboard2

 

Kestrel few of the more important features:

    1) Kestrel is event-driven, asynchronous I / O servers, and is the event loop model. Kestrel event loop model is implemented by libuv. And libuv linux is achieved by the asynchronous epoll, epoll and the I / O multiplexer, which is in very high efficiency thread linux. The efficiency has been known Redis is also using this model.

    Simple that point, Kestrel receive requests like this evolution, from line to buy tickets for an example: You start with a conductor, behind the team longer. The manager said, adding the ticket window. But increase the window when some team very long, some of the team is very short. This is because some people a long time to process, leading the team too long. Then the manager thought of a way to let the conductor at the same time deal with a few people. People continue to wait for slow, fast and speedy completion.

    2) circulating the Kestrel event queue is determined based on the number of CPU cores System / 2. Of course, this value can be set, the minimum is 1 and the maximum is 16. Because the appropriate event queue number in order to improve circulation greater I / O throughput, not better. In the event circular queue, 8 events per treatment.

 

No. I can focus on the public, many years of experience of the original article for everyone to share.

Guess you like

Origin www.cnblogs.com/alunchen/p/11490606.html