当前位置:网站首页>In depth analysis of short URL Technology
In depth analysis of short URL Technology
2022-06-21 05:15:00 【mb61ee79629fa20】
By short URL ( Such as : Chain contraction ) Widespread rise , This short URL technology makes laymen feel tall , Deep unpredictability , Actually , Is not the case, , People who often use short URL services to shorten Links , This article will analyze the short URL service technology , All round technical analysis , This technique is not as difficult as you think . Share , It's a mood !
Short URL service related technology
Short URL service ( Such as : Chain contraction ) The system adopts B/S(Browser/Server) Pattern , Traditional browsers 、 Server mode . The client page uses JQuery Build a user-friendly interface and easy to understand 、 Easy to operate business process . The organization of the server business part adopts Struts+Hibernate+Spring Framework , The database uses MySQL. The development tool is MyEclipse,jdk. In addition, there is the use of poi.jar、jsoup.jar Tools such as jar The package solves the actual related problems in the project ; Chain contraction - Enterprises customize the short chain system to provide enterprises with fast 、 Build your own short chain system at low cost , Promote the promotion and transformation of enterprises , Strengthen the corporate brand image .
One 、 Framework technology of short web address
frame , namely framework, Is a partially complete piece of software that attempts to instantiate the specification ( Son ) System , It's a ( Son ) The system defines the architecture and provides the basic building blocks for creating them , It also defines where specific features need to be improved . Application framework can extract common problems in specific fields , And implement it in part or in whole . When developing application software , Using the framework only needs to concentrate on the business logic design of the system , It is a reusable design for all or part of a software system . The short URL service system uses B/S framework , Use of the Struts+Hibernate+Spring Framework .
Two 、 Short URL Struts technology
Struts It's based on SunJ2EE Platform MVC frame , Mainly using Servlet and JSP Technology to achieve . because Struts Can fully meet the needs of application development , Simple and easy to use , Quick and quick , It has attracted much attention recently .Struts hold Servlet,JSP Custom tags and information resources (message resources) Integrate into a unified framework ,Struts Classes that are coordinated by groups 、Servlet as well as Jsp TagLib form . be based on Struts Structured web The application basically conforms to JSP Model2 Design criteria for , Can be said to be MVC A type of variation of a design pattern .Struts It's a web framework, It's not just a matter of standards Combination of repositories , but Struts It also contains a rich tag library and utility classes that work independently of the framework .
Struts Has its own controller :(Controller), At the same time, some other technologies are integrated to implement the model layer (Model) And view layer (View). At the model level ,Struts It can be easily combined with data access technology , Include EJB,JDBC and ObjectRelationBridge. On the view level ,Struts Can and JSP,Velocity Templates,XSL These presentation layer components are combined .
3、 ... and 、 Short URL Spring technology
Spring It's an open source framework , Created to address the complexity of enterprise application development . Its main function is decoupling , Used to reduce the relationship between components , It improves the flexibility of program structure . The framework is mainly used in the project IoC and AOP Two characteristics .
Spring Reverse by control (IoC.Inverse of Control) Technology that promotes loose coupling . When applied IoC, Other objects that an object depends on are passed in passively , Instead of creating or finding dependent objects by the object itself .IoC And JNDI Just the opposite , It's not objects looking up dependencies from containers , Instead, the container actively passes the dependency to the object without waiting for the object request when the object is initialized .
Spring AOP Provides rich support for aspect oriented programming , Allow the business logic of the application to be separated Cohesive development with system level services . Application objects only implement what they should do , Complete the business logic , They are not responsible for other system level concerns .
Four 、 Short URL Hibernate technology
Hibernate Is an open source object relational mapping framework (ORM), It's right JDBC the Very lightweight object encapsulation , bring Java Programmers can use object programming thinking to manipulate databases as they wish . Avoid using complex JDBC To manipulate the database ORM It is a technology to solve the mismatch between object-oriented and relational databases . In short ,ORM By describing the metadata between objects and databases , take Java The objects in the program are automatically persisted to the relational database . It is essentially a kind of data A transformation from one form of data to another ,Hibernate As a database and Java Between entity classes in the application Data persistence layer support , It realizes the correspondence and communication between entity classes and corresponding databases in the database .
The key technology of short web address
In order to solve the practical problems encountered in the project , Improve the availability and efficiency of the system , In the actual development process, the following are also cited MySQL colony 、JMS(Java Message Service)、HttpClient Technology .
5、 ... and 、 Short URL MySQL colony
stay Web In the application system , Database performance is one of the most important reasons for system performance bottleneck , especially It is in large-scale systems . You can consider using a database cluster to implement the query load , because Generally speaking, there are more database query operations than update operations in any system , Therefore, through multiple The query server shares the query of the database to different query databases to improve the query efficiency of the database .
MySQL The database supports the master-slave replication function of the database , Use the master database to insert data 、 Delete and update operations , The slave database is specially used for database query , In this way, the update operation Separate operations from query operations to different databases , So as to improve the efficiency of the query .
(1) Master database configuration
MySQL Any database server can be the primary database server , Just a simple repair Just change the configuration file . open MySQL Configuration file for , Add the following two lines to the configuration file :
server-id=1
Log-bin=mysql-bin
MySQL Master-slave replication is performed through binary log files , So you have to turn on MySQL The log function of , It's the one above log-bin, At the same time, each database server needs to specify a unique server-id, Usually, the primary database server is specified as 1. Then you need to grant the master database a permission to enter Users who copy rows , The order is as follows :
GRANT replication slave ON*.* TO’repuser’@%’IDENTIFIED BY’123456’
replication slave yes MySQL The name of the permission that represents replication in the database ,repuser It means The user name used when logging in to the primary database server from the database server ,123456 Indicates the login key .
(2) Configure from database
The configuration of the database server is mainly modified MySQL Configuration file for , Join as down :
server-id=2
Log-bin=mysql-bin Start logging on the slave server
master-host= host A primary database server P Address
master-user= user name — The name of the user who performed the replication , Namely grant Users of
master-password= secret key Copy the user's key , Namely grant User key for
master-port= port A port of the primary database server , The default is 3306
After starting the slave database server , You also need to execute the following commands from the command line to start the replication function :
slave start
After startup, you can view the replication status through the following commands :
show slave status
You can see the output of the system , The first one is Slave IO State, Its value is usually Waiting for master to send event, Then you can also see the configuration of the primary database server ip Address 、 Copy the account number and other information .
6、 ... and 、 Short URL JMS
JMS(Java Message Service) Is a standard applied to asynchronous messaging API, It is also used for program communication . however ,JMS Different from other mechanisms , It is mainly manifested in the way of information transmission between systems .
When an application passes JMS When sending a message to another application , There is no direct connection between the two programs . The sending application will deliver the message to a service , The service ensures that messages are delivered to the receiving application . stay JMS There are two main concepts in this book : Message broker (Message Broker) And message destination (Destination). When an application sends a message , The message will be delivered to a message broker, the message server (JMS Server). Message mediations can ensure that messages are delivered to the specified message destination , At the same time, the sender can be released , Enable it to do other business .
stay JMS in , Each message has a message destination . The message target only cares where the message should be obtained —— Not who gets it . stay JMS in , There are two types of message markers : Queues and topics . Respectively applied to the point-to-point model of the queue or the release of abundant questions —— Subscription model .
Point to point messaging model : In the point-to-point model , Each message has a sender and a receiver .
Release —— Subscription messaging model : In this model , The message will be sent to a subject . Just like using queues , Multiple receivers can listen to a topic . however , Unlike queues, messages are no longer delivered to only one recipient , Subscribers to all topics will receive messages .
JMS One of the biggest advantages is when using JMS When sending a message , The client does not have to wait for the message to be processed , Even delivered . The client only needs to send the message to the message broker , You can be sure that the message will be sent Deliver to the appropriate target . Because you don't have to wait , The client can perform other tasks . Because this method can save adults time , The performance of the client can be greatly improved .
During the development of this project , use Spring Of JMS The abstract framework simplifies JMS API Use . The template mechanism it provides hides the typical JMS Implementation details , In this way, we can Focus on the actual work of processing messages , Don't worry about how to create , Access or clear JMS Resources and other transaction management operations .
7、 ... and 、 Short URL HttpClient
HTTP The agreement may be now Interact Most used on 、 The most important agreement , More and more Of Java Applications need to go directly through HTTP Protocol to access network resources . Although in JDK Of java.net Access is already provided in the package HTTP Basic functions of the protocol , But for most applications ,JDK The functions provided by the library itself are not rich and flexible enough .HttpClient yes Apache Jakarta Common Sub projects under , To provide efficient 、 Abreast of the times 、 Feature rich support HTTP Agreed Client programming toolkit , And it supports HTTP Latest version and suggestions of the agreement .
In the development of this system, we mainly use PostMethod How to submit data , Use PostMethod The method is mainly divided into six steps :
1. establish HttpClient Example ;
2. establish PostMethod Example , stay PostMethod The address to be connected is passed in the constructor of ;
3. Call the instance created in the first step execute Method to perform the method example ;
4. read response;
5. Release the connection . Whether the execution method is successful or not , All connections must be released ;
6. Deal with the obtained content .
The above seven technologies , Is the technical use of short URL service .
边栏推荐
- 【数仓建模】传统建模与宽表建模有何差异?基于宽表建模实践
- SSM framework project - enterprise level CRM management system project (take you from building to project completion)
- 猴子都能上手的PUN扩展(房间密码,房间列表,RTC)
- [introduction to UVM== > episode_5] ~ TLM communication
- Abbexa HSD11B2 抗体解决方案
- What is a multi domain SSL certificate? What is the difference with wildcard certificates?
- [data warehouse modeling] what is the difference between traditional modeling and wide table modeling? Wide table based modeling practice
- Little sister's Jenkins study notes
- Selenium principle application - simulate selenium driven browser with requests
- launcher切页动画
猜你喜欢

De duplication according to an attribute in the class

解读复合型新工科机器人教育模式

Selenium principle application - simulate selenium driven browser with requests

Harmonyos second training

JVM performance tuning - 02memory region in JVM
![Z-shaped deformation [one of the forms of the law - > periodic investigation]](/img/84/0f128a4f8e25a0f8bdcd042625a67e.png)
Z-shaped deformation [one of the forms of the law - > periodic investigation]

MyBatic框架(二)

Abnova chicken anti cotton mouse IgG (H & L) secondary antibody (HRP) protocol

Esp32 ssl/tls bidirectional authentication practice

Abnova 11-脱氢-TXB2 ELISA 试剂盒说明书
随机推荐
mysql导致磁盘IO满负荷
Kotlin技术 - 史上全网最全的 Lambda书写形式
Welcome the golden age of maker education + Internet
Abnova β-半乳糖苷酶重组单克隆抗体方案
基于SSM+Bootstrap+MySQL+Thymeleaf的汽车维修管理系统
Three classes for handling strings
Yolo series ------ (II) loss analysis
Qualcomm platform LCD commissioning
unity中复制就能用的定时执行脚本
迎接创客教育+互联网的黄金时代
Performance optimization - memory analysis
dayjs获取当月第一天最后一天 当年第一天最后一天
JS 中的 Event Loop 是什么?
适配器模式Adapter
Glycosylated albumin research - abbexa ELISA kit to help!
Flower sales system based on jsp+servlet+mysql
【url传参】之将对象json转换为?param1=...&param2...的形式
Abnova鸡抗棉鼠 IgG (H&L) 二抗 (HRP) 方案
GooseFS 在云端数据湖存储上的降本增效实践
登录认证(一) —— 几种登录方式简介