[ 
https://issues.apache.org/jira/browse/GEODE-8831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17264392#comment-17264392
 ] 

ASF GitHub Bot commented on GEODE-8831:
---------------------------------------

pivotal-jbarrett commented on a change in pull request #719:
URL: https://github.com/apache/geode-native/pull/719#discussion_r556790760



##########
File path: cppcache/src/TcpConn.cpp
##########
@@ -163,40 +163,40 @@ TcpConn::TcpConn(const std::string ipaddr,
 }
 
 TcpConn::~TcpConn() {
-  std::stringstream ss;
-
   try {
-    ss << "Disconnected " << socket_.local_endpoint() << " -> "
-       << socket_.remote_endpoint();
-
+    LOGFINE("Disconnected %s:%u -> %s:%u",
+            socket_.local_endpoint().address().to_string().c_str(),
+            socket_.local_endpoint().port(),
+            socket_.remote_endpoint().address().to_string().c_str(),
+            socket_.remote_endpoint().port());
     socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both);
 
   } catch (...) {
-    ss = std::stringstream{};
-
-    ss << "Closed socket " << socket_.local_endpoint();
+    LOGFINE("Closed socket %s:%u ",
+            socket_.local_endpoint().address().to_string().c_str(),
+            socket_.local_endpoint().port());
   }
 
   socket_.close();
-
-  LOGFINE(ss.str());
 }
 
 size_t TcpConn::receive(char *buff, const size_t len,
                         std::chrono::milliseconds timeout) {
-  std::stringstream ss;
-  ss << "Receiving " << len << " bytes from " << socket_.remote_endpoint()
-     << " -> " << socket_.local_endpoint();
-  LOGDEBUG(ss.str());
+  LOGDEBUG("Receiving %d bytes from %s:%u -> %s:%u", len,
+           socket_.remote_endpoint().address().to_string().c_str(),
+           socket_.remote_endpoint().port(),
+           socket_.local_endpoint().address().to_string().c_str(),
+           socket_.local_endpoint().port());
   return receive(buff, len, timeout, true);
 }
 
 size_t TcpConn::receive_nothrowiftimeout(char *buff, const size_t len,
                                          std::chrono::milliseconds timeout) {
-  std::stringstream ss;
-  ss << "Receiving an unknown number of bytes from "
-     << socket_.remote_endpoint() << " -> " << socket_.local_endpoint();
-  LOGDEBUG(ss.str());
+  LOGDEBUG("Receiving an unknown number of bytes from %s:%d -> %s:%d",

Review comment:
       In the future, if you want to use more complex logging you should wrap 
with `if (Log::enabled(LogLevel))` block. So the original would be:
   ```C++
   if (Log::enabled(Debug)) {
     std::stringstream ss;
     ss << "Receiving " << len << " bytes from " << socket_.remote_endpoint()
       << " -> " << socket_.local_endpoint();
     Log::log(Debug, ss.str());
   }
    ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


> Performance degradation in Native client with boost::asio.
> ----------------------------------------------------------
>
>                 Key: GEODE-8831
>                 URL: https://issues.apache.org/jira/browse/GEODE-8831
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Alberto Gomez
>            Assignee: Alberto Gomez
>            Priority: Major
>              Labels: pull-request-available
>
> WIth the change in the Geode C++ native client from using ACE_SOCK to 
> boost::asio a significant performance has been observed (around 25% decrease 
> in get operations).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to