Replies: 21 comments
-
mmm what do you mean 5%? do you have a sample code? |
Beta Was this translation helpful? Give feedback.
-
I think I can't access that page or I can't download it |
Beta Was this translation helpful? Give feedback.
-
I think you can grad and drop file directly here |
Beta Was this translation helpful? Give feedback.
-
@zzeng99 nobody can access your link. If you want this issue to be addressed, provide the code somewhere where it can be accessed. I'm puzzled about the secrecy - you publicly report a problem about publicly available code, then got through effort to hide the code exhibiting the problem. why? |
Beta Was this translation helpful? Give feedback.
-
Can't reproduce: void SocketReactorTest::testDataCollection()
{
SocketAddress ssa;
ServerSocket ss(ssa);
SocketReactor reactor;
SocketAcceptor<DataServiceHandler> acceptor(ss, reactor);
std::string data0("{"
" \"src\":\"127.0.0.1\","
" \"id\":\"test0\","
" \"ts\":\"1524864651000001\","
" \"data\":123"
"}\n");
std::string data1("{"
" \"src\":\"127.0.0.1\","
" \"id\":\"test1\","
" \"ts\":\"1524864651123456\","
" \"data\":"
" ["
" {"
" \"tag1\":"
" ["
" {\"val1\":123},"
" {\"val2\":\"abc\"}"
" ]"
" }"
" ]"
"}\n");
std::string data2 = "{"
" \"src\":\"127.0.0.1\","
" \"id\":\"test2\","
" \"ts\":\"1524864652654321\","
" \"data\":"
" ["
" {"
" \"tag1\":"
" ["
" {"
" \"val1\":123,"
" \"val2\":\"abc\","
" \"val3\":42.123"
" },"
" {"
" \"val1\":987,"
" \"val2\":\"xyz\","
" \"val3\":24.321"
" }"
" ],"
" \"tag2\":"
" ["
" {"
" \"val1\":42.123,"
" \"val2\":123,"
" \"val3\":\"abc\""
" },"
" {"
" \"val1\":24.321,"
" \"val2\":987,"
" \"val3\":\"xyz\""
" }"
" ]"
" }"
" ]"
"}\n";
Thread thread;
thread.start(reactor);
SocketAddress sa("127.0.0.1", ss.address().port());
StreamSocket sock(sa);
Stopwatch sw;
sw.start();
sock.sendBytes(data0.data(), static_cast<int>(data0.size()));
sock.sendBytes(data1.data(), static_cast<int>(data1.size()));
sock.sendBytes(data2.data(), static_cast<int>(data2.size()));
while ((DataServiceHandler::_data.size() < 4)) Thread::sleep(1);
sw.stop();
std::cout << "Elapsed time: " << sw.elapsed() << std::endl;
reactor.stop();
thread.join();
assertTrue (DataServiceHandler::_data.size() == 4);
data0.erase(data0.size() - 1);
assertTrue (DataServiceHandler::_data[0] == data0);
data1.erase(data1.size() - 1);
assertTrue (DataServiceHandler::_data[1] == data1);
data2.erase(data2.size() - 1);
assertTrue (DataServiceHandler::_data[2] == data2);
assertTrue (DataServiceHandler::_data[3].empty());
}
|
Beta Was this translation helpful? Give feedback.
-
windows/linux? |
Beta Was this translation helpful? Give feedback.
-
Can be something about the wakeUp function that is not called? |
Beta Was this translation helpful? Give feedback.
-
linux |
Beta Was this translation helpful? Give feedback.
-
Impossible to tell without seeing his code |
Beta Was this translation helpful? Give feedback.
-
yes, I was just guessing about my experience with SocketReactor |
Beta Was this translation helpful? Give feedback.
-
i had uploaded again, try another link please~~ |
Beta Was this translation helpful? Give feedback.
-
@zzeng99 sorry, but I have no time to troubleshoot your application. Perhaps someone else can do it, or if you can provide a poco test case that exhibits this problem, I'll look into it. So far, I was not able to reproduce it. See this for an example of what I'm looking for. |
Beta Was this translation helpful? Give feedback.
-
Adding/removing write read error handler are controlled by a lock in pollset. |
Beta Was this translation helpful? Give feedback.
-
I understand your question. You have to keep in mind the PollSet is changed between the version you have, so probably you should take some time to understand where poll and addevent is blocking each other and understand why idle timeout and busy can do the job because are outside the lock. So I think yes you can, but you have to have a look and dig into socketreactor code |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I think the problem is the lack of idle, timeout and busy callback and the lack of call to wakUp thread. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@aleks-f it seems PollSet::poll locked some unnessasery code, i changed the code as above , and it works. now version 12.4 performance same as version 11.6 |
Beta Was this translation helpful? Give feedback.
-
mmm, I think if you lock this
you probably should lock even the code above
The only way I found to avoid possible time waste is to make the addEventHandler outside the poll code, so in onBusy, onTimeout or in onIdle functions. |
Beta Was this translation helpful? Give feedback.
-
epoll_wait is thread safe. |
Beta Was this translation helpful? Give feedback.
-
Because if you have an empty reactor, suppose you are in the trysleep function (suppose just as example 60 seconds timeout), if a new client arrive and you create the handler, you will never be able to addEventHandler until epoll_wait terminates. That in the current implementation with lock on all the poll function. |
Beta Was this translation helpful? Give feedback.
-
socket send performance with version 12.4 only achieved 5% speed of same code with version 11.6, anything wrong ?
Beta Was this translation helpful? Give feedback.
All reactions