Some questions about WeChat public number receiving data and transmitting to LAN website

Source: Internet
Author: User
Tags php server php website rabbitmq
Just want to look for ideas, listen to the views of the great God, do not ask others to help make detailed plans, only to point out the direction of research. I will Php/java, can write a little python against Baidu.
In the local area network, there is a server running PHP website, this server is in a deep intranet (dynamic public network ip+ network management does not give Port forwarding); Another server, in the room xx cloud, there is an independent public network IP, run PHP for docking with. Now want to do a function, can send the information channel XX Cloud host to forward to the server on the LAN. XX Cloud Host is a Linux operating system, you can consider the operation of Php/python/java, LAN host is a common pc,windows operating system, can run Php/python/java, both hosts are equipped with MySQL database (also is the database of the problem selected ). I wonder if gentlemen has any more ingenious ideas.
Now I have a few ideas, but also ask you comment, thank you!
Database 1.-> Cloud Host (PHP)
The LAN uses Python or Java polling to get new data to the local database.
2.-> Cloud Host (PHP), cross-process transfer to Python-written socket server
LAN uses Python or Java and cloud host to establish socket link, real-time communication into the database.
Database 3.-> Cloud Host (PHP).
Local database and remote database to create master-slave database synchronization (the key is remote can only write not check)
Database 4.-> Cloud Host (PHP)
The local writer program connects directly to two databases to do some work.
These are some of the results of my thinking on this issue, and I feel that each method will affect the speed and efficiency of the overall system.

Reply content:

Just want to look for ideas, listen to the views of the great God, do not ask others to help make detailed plans, only to point out the direction of research. I will Php/java, can write a little python against Baidu.
In the local area network, there is a server running PHP website, this server is in a deep intranet (dynamic public network ip+ network management does not give Port forwarding); Another server, in the room xx cloud, there is an independent public network IP, run PHP for docking with. Now want to do a function, can send the information channel XX Cloud host to forward to the server on the LAN. XX Cloud Host is a Linux operating system, you can consider the operation of Php/python/java, LAN host is a common pc,windows operating system, can run Php/python/java, both hosts are equipped with MySQL database (also is the database of the problem selected ). I wonder if gentlemen has any more ingenious ideas.
Now I have a few ideas, but also ask you comment, thank you!
Database 1.-> Cloud Host (PHP)
The LAN uses Python or Java polling to get new data to the local database.
2.-> Cloud Host (PHP), cross-process transfer to Python-written socket server
LAN uses Python or Java and cloud host to establish socket link, real-time communication into the database.
Database 3.-> Cloud Host (PHP).
Local database and remote database to create master-slave database synchronization (the key is remote can only write not check)
Database 4.-> Cloud Host (PHP)
The local writer program connects directly to two databases to do some work.
These are some of the results of my thinking on this issue, and I feel that each method will affect the speed and efficiency of the overall system.

You can use the subscription/publishing feature of Redis to deliver messages instantly

I'm going to give you a second thought. Increase the thickness of

Cloud Host (PHP), a RABBITMQ Message Queuing server, throw messages into the queue--LAN host from a RABBITMQ client, remove messages from server side, throw into the database

The entire message transfer process is asynchronous, which links will not be blocked, properly, no need to rebuild the wheel

There are many scenarios, like your own 1, 2, 3, 4, this time to look at the business scenario:

    1. Is the time tight?

    2. Is the amount of data large?

    3. Is the latency requirement high?

    4. How much concurrency?

    5. are hardware and software inputs limited?

Can't you use a peanut shell?

These 4 schemes are theoretically feasible. But here are some things to remember in the actual scenario:
1, all of your programs are write operations, if you have read operations, some of the scheme is difficult to do, by asynchronous polling words will certainly have inconsistent data
2, keep a long connection to communicate, if there is no data in a short time, the firewall will not put your link off. This is a very tricky and very common big problem, especially the network management is not to do port forwarding this bad premise.
3. For scenario 4, your network delay will not cause zombie or dirty data for user operation.

Celestial Network quality is very poor, try to avoid multiple remote servers to handle a linear operation, and try to avoid long-distance remote connection.

Common LAN Server, all through the port forwarding (if it is dynamic IP, but also with dynamic domain name). Now your PHP server essentially does not handle business, only proxy, then I have two scenarios, 1 is to build nginx on the public network server, through the dynamic Domain name technology reverse proxy to your LAN server 2, the use of service intermediate price, such as Java Dubbo, External network server Remote Call service within LAN

  • Related Article

    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.