Some questions about how WeChat official accounts receive data and send it to Lan websites

Source: Internet
Author: User
I just want to look for some ideas, listen to the opinions of the great gods, and not ask others to help me make a detailed solution. I just want to point out the research direction. I will use PHPJava to write a little Python against Baidu. In the local Lan, a server runs the php website, which is in the deep intranet (dynamic public IP + network management... I just want to look for some ideas, listen to the opinions of the great gods, and not ask others to help me make a detailed solution. I just want to point out the research direction. I will use PHP/Java to write a little Python against Baidu.
In the local Lan, a server runs the php website, which is in the deep intranet (dynamic public IP + network management does not forward ports). another server, the data center in xx cloud has an independent public IP address and runs php for interconnection. Now we want to develop a function that allows the sending of information to xx VM instances to be forwarded to servers in the LAN. Xx cloud host is a Linux operating system. you can consider running PHP, Python, and Java. a Lan host is a common PC and windows operating system that can run PHP, Python, and Java, both hosts are equipped with MySQL databases (which are also the databases used for this problem ). I don't know if zjun has any subtle ideas ..
Now I have several preliminary ideas. please comment. thank you!
1.-> cloud host (PHP)-> database
The LAN uses Python or Java to poll and obtain new data to the local database.
2.-> cloud host (PHP)-> send cross-process data to the Socket server written in Python
The LAN uses Python or Java to establish a Socket link with the VM instance, and stores real-time communication in the database.
3.-> cloud host (PHP)-> database.
Synchronization between a local database and a remote database to create a master-slave database (the key is that the remote database can only write but not query it)
4.-> cloud host (PHP)-> database
Write a program locally and directly connect the two databases for some operations ..
The above are some of my thoughts on this issue. I feel that every method will affect the overall system speed and efficiency.

Reply content:

I just want to look for some ideas, listen to the opinions of the great gods, and not ask others to help me make a detailed solution. I just want to point out the research direction. I will use PHP/Java to write a little Python against Baidu.
In the local Lan, a server runs the php website, which is in the deep intranet (dynamic public IP + network management does not forward ports). another server, the data center in xx cloud has an independent public IP address and runs php for interconnection. Now we want to develop a function that allows the sending of information to xx VM instances to be forwarded to servers in the LAN. Xx cloud host is a Linux operating system. you can consider running PHP, Python, and Java. a Lan host is a common PC and windows operating system that can run PHP, Python, and Java, both hosts are equipped with MySQL databases (which are also the databases used for this problem ). I don't know if zjun has any subtle ideas ..
Now I have several preliminary ideas. please comment. thank you!
1.-> cloud host (PHP)-> database
The LAN uses Python or Java to poll and obtain new data to the local database.
2.-> cloud host (PHP)-> send cross-process data to the Socket server written in Python
The LAN uses Python or Java to establish a Socket link with the VM instance, and stores real-time communication in the database.
3.-> cloud host (PHP)-> database.
Synchronization between a local database and a remote database to create a master-slave database (the key is that the remote database can only write but not query it)
4.-> cloud host (PHP)-> database
Write a program locally and directly connect the two databases for some operations ..
The above are some of my thoughts on this issue. I feel that every method will affect the overall system speed and efficiency.

You can use the subscription/publish function of redis to instantly transmit messages.

I will give you the second idea to increase the size.

-> Cloud host (PHP)-> initiate a rabbitMQ message queue server, and throw messages into the queue-> Local area network host starts a rabbitMQ client to retrieve messages from the server-> throw the message to the database

The entire message transmission process is asynchronous. no congestion occurs in any part of the process. if this is done properly, no re-engineering is required.

There are many solutions, just like the ones 1, 2, 3, and 4 you have given yourself. in this case, we need to look at the business scenario:

  1. Is the time tight?

  2. Is the data volume large?

  3. Is latency high?

  4. What is the concurrency?

  5. Are there any restrictions on hardware and software investment?

Can't I use peanut shells?

These four solutions are theoretically feasible. However, pay attention to the following points in actual scenarios:
1. all your solutions are write operations. if you have read operations, some of them will be difficult to do. if you rely on asynchronous round robin, there will certainly be data inconsistency.
2. if there is no data in a short period of time, will the Firewall kill your connection. This isVery tricky and CommonProblems, especiallyNetwork administrators do not forward ports.This is a bad premise.
3. for Solution 4, will your network latency cause user operation dead or dirty data.

Tianchao's network quality is poor. try to avoid multiple remote servers from handling a linear operation and avoid remote persistent connections.

Generally, servers in the Lan are forwarded through ports (dynamic domain names are required if dynamic IP addresses are used ). Now, your php server does not process services and only acts as a proxy. I have two solutions: 1. build nginx on a public network server, use dynamic domain name technology to reverse proxy to your LAN Server 2. use the service price center, such as java dubbo, to remotely call services in the Lan on the Internet server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.