Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ These days have been tossing in the Linux under the ASP.NET 5, on the next in the other operating systems in the ASP.NET 5 or. NET applications, in order to complete the MS VM (CoreCLR) run is not far Reach, the effect of the application.

    - Linux dd command applies amplification SWAP partition (Linux)

- linux raid levels and concepts introduced (Linux)

- Oracle: RETURNING clause (Database)

- Install minimize RHEL / CentOS 7 things to do (Linux)

- PF_RING 6.0.2 compiled and installed on Redhat 6.3 x86_64 (Linux)

- CentOS7 installed MySQL (Database)

- Keepalived achieve high availability Nginx Reverse Proxy (Server)

- Why use Docker (Programming)

- Android Application Development: Genymotion can not start solving (Linux)

- GRUB2 boot Ubuntu Manual (Linux)

- Calling Qt libraries to implement functional processes of some summary (Programming)

- ARM assembler instruction debugging method (Programming)

- Linux gprof oprofiling and performance testing tools (Linux)

- Linux ACL permissions (Linux)

- Practical top command (Linux)

- Using Linux strace command trace / debug a program commonly used options (Linux)

- Linux upgrade Glibc (Linux)

- Java call by value and by reference (Programming)

- Linux server security - the web server configuration (Linux)

- Install Firefox 32 official version of the Linux system (Linux)

  These days have been tossing in the Linux under the ASP.NET 5, on the next in the other operating systems in the ASP.NET 5 or. NET applications, in order to complete the MS VM (CoreCLR) run is not far Reach, the effect of the application.

  Add Date : 2017-08-31      
  Cloud platform used in the socket server is our own definition of a communication protocol, and through the C # to achieve a socket service.

The service is currently running in the IIS container with the web service, listening for the port by starting a new thread that never exits.

In the initial development, because some of the messages within the service is not to capture the exception, for example, the client sent the wrong message format, trying to close a connection has been released and other operations, will cause the monitor thread unexpectedly exit.

Later, as the use of the system to repair these problems, socket services on the stability of a lot, but after more than a week, socket services will occasionally hang up, check the system log did not find any system anomalies. To the Internet to check some of the information on IIS and found that IIS has a set of intelligent process recovery mechanism, the purpose is to improve server performance, the process of recovery when the memory session, cache and the running thread will be cleared away, so the use of IIS As a server, to ensure that session, cache and other resources available for a long time, put them into the database, or distributed into other servers to save. Process recovery, IIS will start a new thread, the original site deployed in IIS port will be re-listening, but before the user's own start-up of those threads IIS will not start.

Internet was given a solution to the IIS7 configuration:

Recycle - Fixed time interval (minutes) to zero

        - Change virtual / private memory limit (KB) to 0

Process model - idle timeout (minutes) to 0

This method disables IIS process reclamation, but this can cause long-running performance degradation of the server. Moreover, after several attempts to configure this after a long time after the operation, IIS will be on the process of recycling.

Think of IIS in the process of recovery will restart their own running on the site's port monitor, we can also run a service to determine the socket server thread running status is normal, if not normal, then restart the service. This service must be running outside of IIS.

The specific approach is:

The web service provides an interface to get the state of a process


Provides an interface to restart the socket service


In IIS outside through other methods to start a service, every 10 seconds to access the state of the process to obtain the interface, if not normal call to restart the socket service interface.

The current approach is to start a Nodejs service:

/ / This service is used to monitor the cloud platform socket service process, if the process crashes or restart, restart the socket service, ws service, task timeout detection
Var http = require ( 'http');
Var moment = require ( 'moment')
// var host = "http: // xxx"; // local debugging
Var host = "http: // xxxxxx"; // Intranet services
// var host = "http: // xxxx"; // public network service
Var statusCheck = "xxx";
Var startSocket = "xxx";
Var startWs = "xxx";
Var taskTimeout = "xxx";
Var inteval;
Function start () {
    Inteval = setInterval (checkStatus, 20000);
Function end () {
    ClearInterval (inteval);
Start ();
Function checkStatus () {
    Try {
        Http.get (host + statusCheck, function (res) {
            Res.on ( 'data', function (data) {
                Var socketStatus = JSON.parse (data.toString ());
                If (socketStatus.socketServer == 'hang up' || socketStatus.socketServer == 'Stopped') {
                    Console.log (moment (new Date ()). Format ( 'YYYY-MM-DD HH: mm: ss') + "socket service is not available, restarting")
                    // Restart the service
                    RestartService ();
        }). On ( 'error', function (e) {
            Console.log (moment (new Date ()). Format ( 'YYYY-MM-DD HH: mm: ss') + "ERROR:" + e.message);
    Catch (e) {
        Console.log (e.message);
Function restartService () {
    // end ();
    Http.get (host + startSocket, function (res) {
        StatusCode (res.statusCode, 'startSocket');
        Console.log (moment (new Date ()). Format ( 'YYYY-MM-DD HH: mm: ss') + "restart socketserver" + res.statusCode);
        Res.resume ();
    Http.get (host + startWs, function (res) {
        StatusCode (res.statusCode, 'startWs');
        Console.log (moment (new Date ()). Format ( 'YYYY-MM-DD HH: mm: ss') + "restart wsserver" + res.statusCode);
        Res.resume ();
    Http.get (host + taskTimeout, function (res) {
        StatusCode (res.statusCode, 'taskTimeout');
        Console.log (moment (new Date ()). Format ( 'YYYY-MM-DD HH: mm: ss') + "restart task state monitoring" + res.statusCode);
        Res.resume ();
    Var status = {startSocket: false, startWs: false, taskTimeout: false};
    Function statusCode (code, name) {
        If (code == 200) {
            Status [name] = true;
        If (status.startSocket && status.startWs && status.taskTimeout) {
            // start ();

This approach currently has two drawbacks:

1. IIS process each time recycling, socket services will be a few seconds time is not available

2.socket service running on the web server, is not conducive to future expansion of the web server or socket server, connected to the A server device can not be B server access

The future direction of improvement is:

Separate the socket server, re-design of Web server and socket server communication methods.

This can make the socket service is not affected by the IIS server configuration, and can be free to expand the web server and socket server.
- How to Install Puppet in the Ubuntu 15.04 (Server)
- grep regular expression (Linux)
- The Objects in JavaScript (Programming)
- Linux System Getting Started Learning: DeVeDe installed on Linux to create a video DVD (Linux)
- Introduction to thread pooling and simple implementation (Programming)
- BusyBox making the file system (Linux)
- Java multi-threaded shared communications variables (Programming)
- The difference between VMware virtual machine network mode (Linux)
- PXE + Kickstart automatically install CentOS 6.5 (Linux)
- Use Ansible efficient delivery Docker container (Server)
- Linux security configuration (Linux)
- FastDFS installation and deployment (Server)
- Ubuntu 14.04 after the restart the default maximum screen brightness solutions (Linux)
- Linux character device - automatically creates the device nodes and devices (Linux)
- Linux can modify the maximum number of open files (Linux)
- Linux operating system Study Notes (Linux)
- Linux network security probing tools Hping2 (Linux)
- Single-node Hadoop installation notes distributed pseudo & (Server)
- How to understand the difference between synchronous and asynchronous non-blocking blocking (Programming)
- Ubuntu How to install and upgrade Linux Kernel 3.15 (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.