You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "JosiahWI (via GitHub)" <gi...@apache.org> on 2023/10/12 02:58:44 UTC

[PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

JosiahWI opened a new pull request, #10587:
URL: https://github.com/apache/trafficserver/pull/10587

   Summary of changes:
   
   - Remove unused headers.
   - Break the PreWarm namespace out of PreWarmManager and leave it in iocore.
   - Move PreWarmManager back to proxy/http (I had moved it to iocore earlier).
   - Use a callback to reconfigure the prewarm manager when sni.yaml is reloaded.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10587:
URL: https://github.com/apache/trafficserver/pull/10587#issuecomment-1759811619

   There's no AuTest verifying that the reconfiguration takes place, and I don't see a way to verify it. So unless someone can propose a good way to test, I'm going to leave it untested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on code in PR #10587:
URL: https://github.com/apache/trafficserver/pull/10587#discussion_r1357588472


##########
iocore/net/PreWarm.h:
##########
@@ -0,0 +1,132 @@
+/** @file
+
+  Pre-Warming NetVConnection
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#pragma once
+
+// inknet
+#include "SSLTypes.h"
+#include "YamlSNIConfig.h"
+
+// api
+#include "api/Metrics.h"
+
+// records
+#include "records/I_RecHttp.h"
+
+// tscore
+#include "tscore/CryptoHash.h"
+#include "tscore/ink_hrtime.h"
+
+#include <netinet/in.h>
+
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <unordered_map>
+
+namespace PreWarm
+{
+struct Dst {
+  Dst(std::string_view h, in_port_t p, SNIRoutingType t, int a) : host(h), port(p), type(t), alpn_index(a) {}
+
+  std::string host;
+  in_port_t port      = 0;
+  SNIRoutingType type = SNIRoutingType::NONE;
+  int alpn_index      = SessionProtocolNameRegistry::INVALID;
+};
+
+using SPtrConstDst = std::shared_ptr<const Dst>;

Review Comment:
   Great idea!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #10587:
URL: https://github.com/apache/trafficserver/pull/10587#discussion_r1357019229


##########
proxy/http/PreWarmManager.h:
##########
@@ -312,6 +216,16 @@ class PreWarmQueue : public Continuation
 class PreWarmManager
 {
 public:
+  PreWarmManager()
+  {
+    // We use the callback because it would introduce a circular dependency
+    // for SNIConfig to explicitly call prewarmManager.reconfigure().
+    // Because prewarmManager is global there's not a good place to set
+    // this, but as long as there's only one instance of this class
+    // there should not be an issue.
+    SNIConfig::set_on_reconfigure_callback([this]() { this->reconfigure(); });

Review Comment:
   🥇 



##########
proxy/http/PreWarmManager.h:
##########
@@ -312,6 +216,16 @@ class PreWarmQueue : public Continuation
 class PreWarmManager
 {
 public:
+  PreWarmManager()
+  {
+    // We use the callback because it would introduce a circular dependency
+    // for SNIConfig to explicitly call prewarmManager.reconfigure().
+    // Because prewarmManager is global there's not a good place to set
+    // this, but as long as there's only one instance of this class
+    // there should not be an issue.
+    SNIConfig::set_on_reconfigure_callback([this]() { this->reconfigure(); });

Review Comment:
   🥇 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #10587:
URL: https://github.com/apache/trafficserver/pull/10587#discussion_r1357587885


##########
iocore/net/PreWarm.h:
##########
@@ -0,0 +1,132 @@
+/** @file
+
+  Pre-Warming NetVConnection
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#pragma once
+
+// inknet
+#include "SSLTypes.h"
+#include "YamlSNIConfig.h"
+
+// api
+#include "api/Metrics.h"
+
+// records
+#include "records/I_RecHttp.h"
+
+// tscore
+#include "tscore/CryptoHash.h"
+#include "tscore/ink_hrtime.h"
+
+#include <netinet/in.h>
+
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <unordered_map>
+
+namespace PreWarm
+{
+struct Dst {
+  Dst(std::string_view h, in_port_t p, SNIRoutingType t, int a) : host(h), port(p), type(t), alpn_index(a) {}
+
+  std::string host;
+  in_port_t port      = 0;
+  SNIRoutingType type = SNIRoutingType::NONE;
+  int alpn_index      = SessionProtocolNameRegistry::INVALID;
+};
+
+using SPtrConstDst = std::shared_ptr<const Dst>;

Review Comment:
   TLSTunnelSupport needs only `PreWarm::Dst` and `PreWarm::SPtrConstDst`. We can leave rest of PreWarm namespace code in the `proxy/http/PreWarmManager.h`. That'll clarify which structure is required by `iocore/net` and `proxy/http`. What do you think?



##########
iocore/net/PreWarm.h:
##########
@@ -0,0 +1,132 @@
+/** @file
+
+  Pre-Warming NetVConnection
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#pragma once
+
+// inknet
+#include "SSLTypes.h"
+#include "YamlSNIConfig.h"
+
+// api
+#include "api/Metrics.h"
+
+// records
+#include "records/I_RecHttp.h"
+
+// tscore
+#include "tscore/CryptoHash.h"
+#include "tscore/ink_hrtime.h"
+
+#include <netinet/in.h>
+
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <unordered_map>
+
+namespace PreWarm
+{
+struct Dst {
+  Dst(std::string_view h, in_port_t p, SNIRoutingType t, int a) : host(h), port(p), type(t), alpn_index(a) {}
+
+  std::string host;
+  in_port_t port      = 0;
+  SNIRoutingType type = SNIRoutingType::NONE;
+  int alpn_index      = SessionProtocolNameRegistry::INVALID;
+};
+
+using SPtrConstDst = std::shared_ptr<const Dst>;

Review Comment:
   `TLSTunnelSupport` needs only `PreWarm::Dst` and `PreWarm::SPtrConstDst`. We can leave rest of PreWarm namespace code in the `proxy/http/PreWarmManager.h`. That'll clarify which structure is required by `iocore/net` and `proxy/http`. What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #10587:
URL: https://github.com/apache/trafficserver/pull/10587#discussion_r1357588602


##########
proxy/http/PreWarmManager.h:
##########
@@ -312,6 +216,16 @@ class PreWarmQueue : public Continuation
 class PreWarmManager
 {
 public:
+  PreWarmManager()
+  {
+    // We use the callback because it would introduce a circular dependency
+    // for SNIConfig to explicitly call prewarmManager.reconfigure().
+    // Because prewarmManager is global there's not a good place to set
+    // this, but as long as there's only one instance of this class
+    // there should not be an issue.
+    SNIConfig::set_on_reconfigure_callback([this]() { this->reconfigure(); });

Review Comment:
   Nice idea to get rid of the cyclic dependency 👍



##########
proxy/http/PreWarmManager.h:
##########
@@ -312,6 +216,16 @@ class PreWarmQueue : public Continuation
 class PreWarmManager
 {
 public:
+  PreWarmManager()
+  {
+    // We use the callback because it would introduce a circular dependency
+    // for SNIConfig to explicitly call prewarmManager.reconfigure().
+    // Because prewarmManager is global there's not a good place to set
+    // this, but as long as there's only one instance of this class
+    // there should not be an issue.
+    SNIConfig::set_on_reconfigure_callback([this]() { this->reconfigure(); });

Review Comment:
   Nice idea to get rid of the cyclic dependency 👍



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Break cycle between iocore/inknet and proxy/http [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt merged PR #10587:
URL: https://github.com/apache/trafficserver/pull/10587


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org