What are the major server-side languages currently available? What are their characteristics

Go

High performance – coroutines

Golang source level support coroutines, simple implementation. When the bottom layer is blocked, it will automatically switch. That is to say, the logical layer realizes asynchrony in a synchronous way, which makes full use of system resources and avoids the anti-human asynchrony callback of the asynchronous state machine. The implementation method is more intuitive and simple. The Golang coroutine is maintained through multi-threading, so it cannot avoid the use of locks, but it also greatly solves the problem of r&d efficiency.

ecological

With Google endorsing, ecologically rich, easy access to a variety of high quality wheels. This allows users to focus on business logic and avoid reinventing the wheel.

The deployment of

Simple deployment, source code compiled into the execution file, you can run directly, reducing the dependence on other plug-ins. Unlike other languages, execution files rely on plugins, libraries, and the development machine works fine, but it won’t work in production, requiring various installations and versions to match.

The characteristics of

I am optimistic about the future of Go. It has found a balance between development speed and running speed, running speed comparable to Java, and development simplicity comparable to PHP. It is a very competitive development language in the 21st century.

Java

simplicity

Java language inherited the advantages of C++ language, get rid of C++ to learn more difficult to multiple inheritance, Pointers and other concepts, so the Java language is easier to learn, more convenient to use.

object-oriented

Java is an object-oriented programming language.

distribution

Java is designed to work on the web. It is a distributed language. So once you write a program in Java, you can apply it everywhere. Can save a lot of manpower and material resources.

Compilation and interpretability

Java compilers generate bytecode instead of the usual machine code, making Java development programs much faster than in other languages.

robustness

Java was originally designed to write highly reliable and robust software. So it’s easy to write reliable software in Java. At present, a lot of third party trading system, bank platform and background electronic trading system will use Java language development.

security

Java’s storage allocation model is one of its main defenses against malicious code. So many large enterprise projects will choose to use Java development.

portability

Java is platform-independent, and programs written in Java can run on any operating system.

A high performance

Java is a compiled and interpreted language, so it is not as fast as a fully compiled language. But Java designers made “just in time” compilers so that full compilation could be achieved.

Multi-line altogether

Java is a multicue language, which can execute multiple programs at the same time and handle different tasks.

dynamic

Designed to adapt to a changing environment, the Java language is a dynamic language.

Python

Python is an object-oriented, interpreted, weakly typed scripting language, and it is a powerful and well-developed general-purpose language.

Compared to other programming languages, such as Java,Python code is very simple and easy to get started with. For example, if you need 100 lines of code to do something in Java, you might need 20 lines of code in Python, which is one of Python’s most attractive features.

Python’s two main features are clear syntax and extensibility:

Python’s syntax is so clear that it is not even a free-form language. For example, it requires that the next line of an if statement must be indented to the right or it will not compile. Python’s extensibility is reflected in its modules. Python has one of the richest and most powerful libraries in the scripting language (aptly called batteries included), These libraries cover file I/O, GUI, network programming, database access, text operations and most of the application scenarios.

In addition, the Python community is well developed, and Python often has open source modules to provide solutions for even niche applications.

PHP

  1. Low cost, ease of use, cross-platform compatibility, stability, quick and easy to learn, extensive database connection, scalability, HTML embedded development
  2. PHP has been referred to as “PHP is the best language” for a good reason. It’s very easy to use, very developer friendly, but it’s not secure enough, it doesn’t perform well enough, I personally switched from PHP to Go.

How is TCP compared with UDP?

TCP has the following advantages:

  • Reliable and stable
  • TCP establishes a connection with three handshakes before transmitting data
  • TCP provides acknowledgment, window, retransmission, and congestion control mechanisms during data transmission
  • TCP disconnects after data transmission is complete to save system resources

Disadvantages of TCP:

  • Slow, low transmission efficiency
  • The system resource usage is high
  • Vulnerable to DOS/DDOS/CC attacks

Advantages of UDP:

  • fast
  • This mode consumes less system resources
  • Safer than TCP

Disadvantages of UDP:

  • Unreliable, unstable
  • Without a reliable mechanism, packets are easily lost when network conditions are not good

Noun explanations of various attacks

  • DOS attack: Denial of Service attack. The purpose of a Denial of Service attack is to prevent a computer or network from providing normal services.
    • Common DOS attacks are
    • Computer network bandwidth attack: Attacks the network with huge traffic, depleting all available network resources and preventing legitimate user requests from passing.
    • Connectivity attack: Bombards the computer with connection requests so large that all available operating system resources are exhausted and the computer is unable to process requests from normal users.
  • Distributed Denial of Service attacks: Distributed Denial of Service attacks are developed from DOS attacks. Because it is difficult for individual hackers to use high bandwidth resources, hackers have developed distributed attacks to overcome this disadvantage.
    • A simple tool used by an attacker to collect a large amount of network bandwidth to launch a large number of attack requests on a target at the same time. This is a DDOS attack.
  • CC Attack: Challenge Collapsar Attack, a black hole Attack, is a type of DDoS Attack
    • A proxy server is used to send a large number of seemingly legitimate requests to the victim server

What’s the difference between a blocking call and a synchronous call?

  • First, a blocking call is different from a synchronous call
  • At the bottom, the current thread of the synchronous call is still active, but logically does not return. The current thread can also process a variety of other information.
  • This is not the case with a blocking call, which says that the current thread is blocked and unavailable, and does not return. And the current thread cannot process other information.

A deeper understanding of synchronous asynchronous I/O and blocking non-blocking I/O

  • Firstly, the operation of network IO can be divided into two stages: preparation stage and operation stage
    • Preparation phase: Determines whether to enter the preparation phase, that is, waiting for data to be available. This phase is completed in the kernel process
    • Operation phase: The actual IO calls are made and the data is copied from the kernel buffer to the user process buffer.
  • Synchronous or asynchronous I/O
    • Refers to the mechanism for accessing data, that is, the way actual I/O operations are performed
    • Generally, the synchronization mode actively sends a request and waits for the I/O operation to complete. Applications are suspended before the I/O operation is complete
    • Asynchronism means that the user starts to perform his/her own work after triggering AN I/O operation. When the I/O operation is complete, the user is notified that the I/O operation is complete (== Asynchronism is notification ==). In this way, the process does not block when reading/writing data.
  • Block or not block IO
    • This refers to how the first stage of an IO operation is completed (the kernel buffer is not ready for data), and how the application behaves before the data is ready. If the process is suspended, it is blocking IO, otherwise it is not blocking IO.
    • Blocking and non-blocking are different ways for processes to access data, depending on the ready state of the IO operation.
    • To put it more simply: blocking and non-blocking are implementations of read or write operations, in which the read or write operations wait; In non-blocking mode, the read or write function returns a status value immediately.

What’s the difference between HTTP and HTTPS?

  1. HTTPS requires you to apply for a certificate from a CA. Generally, there are few free certificates, so a certain cost is required.
  2. HTTP is a hypertext transmission protocol, and information is transmitted in plain text. HTTPS is a secure SSL/TLS encryption transmission protocol.
  3. HTTP and HTTPS use completely different connections and use different ports, the former 80 and the latter 443. HTTP connections are simple and stateless;
  4. HTTPS is a network protocol that uses SSL, TLS, and HTTP to encrypt transmission and authenticate identity. It is more secure than HTTP.

Session vs. cookie?

  1. Session data is stored on the server, and cookie data is stored on the client browser
  2. Cookie is not very secure, we can query forged storage and then the cookie of the client to cheat the request, for security, session should be used
  3. Session will be stored on the server for a certain period of time. When the number of visits increases, the server performance will be affected. Therefore, cookies can be used to ensure the server performance
  4. A single cookie cannot store more than 4KB of data, and many browsers limit the number of cookies a site can store
  5. Cookies are not cross-domain
  6. Session cookies and persistent cookies:
  7. Session cookies are cookies that disappear with the closing of the browser without setting the expiration time, and are generally stored in memory.
  8. Persistent cookies that set the expiration time, even if closed the browser will not disappear cookies, generally exist in the hard disk; Opening the browser again remains valid until the expiration date is reached.
  9. Session sharing:
  10. How to solve the problem of SessionId sharing among different websites with a single server (same parent domain name but different sub-domain name)? Since domain names are different (A.test.com, B.test.com) and sessionids are stored in different cookies, our idea is to change the storage scope of cookies to the parent domain name to achieve the purpose of cookie sharing, so as to achieve the sharing of sessionids.
  11. The downside of this is that cookie information is also shared between sub-sites
  12. It is a good practice to store sensitive data, such as login information, in session, and other non-sensitive data in cookies

What is the process of entering a URL into a browser rendering page?

  1. Enter the URL in the client browser.
  2. It is sent to the DNS to obtain the IP address of the WEB server corresponding to the domain name.
  3. The client browser establishes a TCP(Transmission Control Protocol) connection with the WEB server.
  4. The client browser sends an HTTP or HTTPS request to the WEB server at the corresponding IP address.
  5. The WEB server responds to the request by returning the specified URL data or error message; If redirection is set, it is redirected to the new URL.
  6. The client browser downloads data and parses HTML source files. During the process of parsing, the page is typeset. After parsing, the basic page is displayed in the browser.
  7. Analyze the hyperlinks in the page and display them on the current page. Repeat the above process until no hyperlinks need to be sent and complete the display of the page.

Blocking non-blocking IO and synchronous asynchronous IO are still not in place.