Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
Why
Redirection mechanism is widely used in proxy-based scenario.
Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
What to do
We'll add a new global/session variable, say, redirect_url. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).
Internally the server might have a check to ensure that the value of this variable is a valid url.
This variable is appended to the default value of session_track_system_variables variable.
When this variable is changed, the existing SESSION_TRACK_SYSTEM_VARIABLES implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.
Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.
Thoughts
- perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.
Possible use cases:
- always redirect all clients to a new location
- set @@global.redirect_url or start the server with --redurect-url= or put it in my.cnf
- redirect to a group of servers randomly
- create a table with connection urls, one per row.
- use an sql script that selects a random row from it and sets @@redirect_url to this value
- specify this script in the --init-connect server parameter
- dynamically redirect from the master to one of the slaves
- same as above, but use INFORMATION_SCHEMA.PROCESSLIST to get the list of active slaves.
and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.
What to Do
Client/Server Protocol change needs both client and server support.
Ending connection OK_Packet info field might contain redirection information.
Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
There is no recursion, meaning that connector that have been redirect will not take another redirection in account.
info field format is then:
Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n |
HostDescription:
<host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
|
specific redirection option:
option | description |
---|---|
user | if set, must superseed connection user. |
ttl | validity timeout in second. This permit caching redirection client side. 0 means no caching 'default' |
Attachments
Issue Links
- blocks
-
CONC-599 Add support for connection redirection on the Connector/C
-
- Open
-
-
CONJ-731 Connection Redirection Mechanism implementation
-
- Closed
-
-
CONJ-981 Add support for connection redirection
-
- Closed
-
-
CONJS-207 Add support for connection redirection
-
- Closed
-
-
MXS-4153 Graceful Restart
-
- Open
-
-
R2DBC-66 Add support for connection redirection
-
- Closed
-
- causes
-
MDEV-32254 Server crashes when adding records to table after setting redirect_url with empty variable
-
- Closed
-
-
MDEV-32525 Server startup fails to validate invalid redirect_url
-
- Closed
-
- is blocked by
-
MDEV-32525 Server startup fails to validate invalid redirect_url
-
- Closed
-
- relates to
-
CONPY-60 Support redirection mechanism
-
- Open
-
-
MDEV-34009 Add instant, obligatory, server-initiated failover mechanism to MariaDB Client/Server Protocol
-
- Closed
-
-
MXS-4635 Provide load balancing metadata to connectors
-
- Closed
-
-
MXS-5238 Connection redirection: add redirect_url parameter
-
- Closed
-
-
ODBC-281 add redirection mechanism
-
- Open
-
-
CONC-468 Add redirection mechanism
-
- Open
-
-
MDEV-31609 Send initial values of system variables in first OK packet
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
h1. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h1. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Heading 1||Heading 2|| |Col A1|Col A2| ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h1. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h1. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
Description |
h1. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h1. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h1. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h1. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
Description |
h1. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h1. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
Description |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
Description |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
Attachment | redirection.pcapng [ 45610 ] | |
Attachment | redirection.png [ 45611 ] |
Attachment | screenshot-1.png [ 45838 ] |
Attachment | screenshot-2.png [ 45839 ] |
Attachment | screenshot-3.png [ 45842 ] |
Attachment | screenshot-4.png [ 45843 ] |
Link |
This issue blocks |
Description |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. info field format is then: The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
Description |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. info field format is then: The routine is # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION. | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection | # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION. # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet. # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host. # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information. The Redirection Information Packet schema is ||Field Type||Field Name||Notes|| |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.| |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.| |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.| |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.| |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.| |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.| For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm [3] https://mariadb.com/kb/en/library/1-connecting-connecting/ |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| |
Link | This issue relates to CONJS-135 [ CONJS-135 ] |
Description |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| |
Workflow | MariaDB v3 [ 86662 ] | MariaDB v4 [ 130819 ] |
Assignee | Julien Fritsch [ julien.fritsch ] |
Assignee | Julien Fritsch [ julien.fritsch ] |
Assignee | Julien Fritsch [ julien.fritsch ] |
Assignee | Julien Fritsch [ julien.fritsch ] |
Link | This issue blocks CONTRIB-3 [ CONTRIB-3 ] |
Description |
h2. Why
Redirection mechanism is widely used in proxy-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| |
h2. Why Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects \[1\] or Oracle redirected connections \[2\]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| |
Description |
h2. Why Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects \[1\] or Oracle redirected connections \[2\]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. * the server can disallow changing of this variable in an active transaction. Or it can delegate this check to connectors, perhaps a connector would want to reconnect and replay the transaction? h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
Fix Version/s | 11.3 [ 28565 ] |
Description |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. * the server can disallow changing of this variable in an active transaction. Or it can delegate this check to connectors, perhaps a connector would want to reconnect and replay the transaction? h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. * the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction. h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
Description |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. * the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction. h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
Assignee | Yuchen Pei [ JIRAUSER52627 ] |
Link |
This issue relates to |
Status | Open [ 1 ] | In Progress [ 3 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Assignee | Yuchen Pei [ JIRAUSER52627 ] | Sergei Golubchik [ serg ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Description |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
h2. Why
Redirection mechanism is widely used in proxy\-based scenario. Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue. Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted. h2. What to do We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX). Internally the server might have a check to ensure that the value of this variable is a valid url. This variable is appended to the default value of {{session_track_system_variables}} variable. When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it. Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction. h3. Thoughts * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code. h3. Possible use cases: * always redirect all clients to a new location ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf * redirect to a group of servers randomly ** create a table with connection urls, one per row. ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value ** specify this script in the {{--init-connect}} server parameter * dynamically redirect from the master to one of the slaves ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves. and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities. {panel:title=Original specs for comparison:|bgColor=#EEEEEE} h2. What to Do Client/Server Protocol change needs both client and server support. Ending connection [OK_Packet|https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information. Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection. There is no recursion, meaning that connector that have been redirect will not take another redirection in account. info field format is then: {code:java} Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n {code} HostDescription: {code:java} <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))] {code} specific redirection option: ||option||description|| |user|if set, must superseed connection user.| |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'| {panel} |
Assignee | Sergei Golubchik [ serg ] | Yuchen Pei [ JIRAUSER52627 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Assignee | Yuchen Pei [ JIRAUSER52627 ] | Sergei Golubchik [ serg ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Assignee | Sergei Golubchik [ serg ] | Yuchen Pei [ JIRAUSER52627 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Assignee | Yuchen Pei [ JIRAUSER52627 ] | Sergei Golubchik [ serg ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Link | This issue blocks TODO-4253 [ TODO-4253 ] |
Assignee | Sergei Golubchik [ serg ] | Yuchen Pei [ JIRAUSER52627 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Link | This issue blocks TODO-4253 [ TODO-4253 ] |
Link | This issue is part of TODO-4253 [ TODO-4253 ] |
Status | Stalled [ 10000 ] | In Testing [ 10301 ] |
Assignee | Yuchen Pei [ JIRAUSER52627 ] | Ramesh Sivaraman [ JIRAUSER48189 ] |
Labels | client protocol proxy | Preview_11.3 client protocol proxy |
Link |
This issue causes |
Assignee | Ramesh Sivaraman [ JIRAUSER48189 ] | Yuchen Pei [ JIRAUSER52627 ] |
Status | In Testing [ 10301 ] | Stalled [ 10000 ] |
Link |
This issue causes |
Link |
This issue is blocked by |
Status | Stalled [ 10000 ] | In Testing [ 10301 ] |
Assignee | Yuchen Pei [ JIRAUSER52627 ] | Ramesh Sivaraman [ JIRAUSER48189 ] |
Assignee | Ramesh Sivaraman [ JIRAUSER48189 ] | Yuchen Pei [ JIRAUSER52627 ] |
Status | In Testing [ 10301 ] | Stalled [ 10000 ] |
Comment | [ 1h 30m ] |
Fix Version/s | 11.3.1 [ 29416 ] | |
Fix Version/s | 11.3 [ 28565 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Component/s | Protocol [ 14604 ] | |
Component/s | Server [ 13907 ] |
Link |
This issue relates to |
Zendesk Related Tickets | 202147 119111 |