Skip to content

Conversation

ifplusor
Copy link
Contributor

@ifplusor ifplusor commented Jan 8, 2019

  • feature: use only one event loop for all TcpTransport.

@ShannonDing ShannonDing added bug Something isn't working enhancement New feature or request labels Jan 9, 2019
@ShannonDing ShannonDing added this to the 1.2.1 milestone Jan 9, 2019
@lizhanhui
Copy link
Contributor

This pull request brings huge improvement to the thread model. The current implementation is ugly and inefficient. Thanks @ifplusor

@ifplusor ifplusor force-pushed the feature-eventloop branch 2 times, most recently from ec579ce to 7873156 Compare January 11, 2019 19:17
Copy link
Contributor

@stcai stcai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, but there are some little problems need to fix.

LOG_INFO("TcpRemotingClient::boost asio async service running");

#if !defined(WIN32) && !defined(__APPLE__)
prctl(PR_SET_NAME, "RemotingAsioT", 0, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thread name looks weired. Could you please name a regular one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suffix 'T' is thread just as 'TP' is threadpool. and i have no idea what is fitting

@ifplusor ifplusor force-pushed the feature-eventloop branch 6 times, most recently from 902b53b to 125c84e Compare January 18, 2019 09:22
@ifplusor ifplusor changed the title feature: only one event loop for all TcpTransport. Update: update network interface. Jan 18, 2019
@ShannonDing ShannonDing modified the milestones: 1.2.1, 1.2.2 Jan 21, 2019
@ShannonDing
Copy link
Member

This is a big improvement, it is better to verify it more carefully and then release in the next version.

@ifplusor
Copy link
Contributor Author

ifplusor commented Jan 21, 2019

@ShannonDing you are right. i am tracing another infinite loop issue, it block in rebalance. and i am also testing this in my beta environment.

@ifplusor ifplusor force-pushed the feature-eventloop branch 7 times, most recently from 29848f9 to 908517c Compare January 28, 2019 08:17
@ifplusor ifplusor force-pushed the feature-eventloop branch 2 times, most recently from be1a165 to 1228032 Compare January 30, 2019 14:38
Copy link
Contributor

@jovany-wang jovany-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I left some comments.

Copy link
Contributor

@jovany-wang jovany-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add more detail docstring for the new file like eventloop.

Also, I have not finished reviewing this such huge PR yet.

bool bProducePullRequest);
virtual void onException();
virtual asyncCallBackType getCallbackType() { return sendCallbackWrap; }
~SendCallbackWrap() override = default;;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's unnecessary to remove virtual here though it's an override.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clion prompt to use override and remove virtual.

public:
SendCallbackWrap(const string& brokerName, const MQMessage& msg,
AsyncCallback* pAsyncCallback, MQClientAPIImpl* pclientAPI);
SendCallbackWrap(const string &brokerName, const MQMessage &msg,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove using namespace std; and use std::string here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, best to avoid namespace pollution.

Copy link
Contributor Author

@ifplusor ifplusor Feb 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using namespace std;

in another head file.

int m_requestCode;
int m_opaque;
bool m_sendRequestOK;
int64 m_timeout; // ms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int64 m_timeout_ms;

#endif

// avoid async io service stops after first timer timeout callback
boost::asio::io_service::work work(m_async_ioService);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename m_async_ioService to m_async_io_service

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't rename this variable.

@ifplusor ifplusor force-pushed the feature-eventloop branch 2 times, most recently from 5f224bd to a164e06 Compare February 18, 2019 09:08
@ifplusor ifplusor force-pushed the feature-eventloop branch from ad18df4 to 4e5a8cd Compare March 4, 2019 02:19
@ifplusor ifplusor force-pushed the feature-eventloop branch 3 times, most recently from 0996785 to 358546a Compare March 15, 2019 10:19
@ifplusor ifplusor force-pushed the feature-eventloop branch 2 times, most recently from a8b2970 to 122cd44 Compare April 3, 2019 11:25
@ifplusor ifplusor force-pushed the feature-eventloop branch 2 times, most recently from 1e00c4e to b3f1c5a Compare April 18, 2019 07:29
@ShannonDing ShannonDing modified the milestones: 1.2.2, 1.2.3 Apr 19, 2019
@messense
Copy link
Member

Any progress on getting this merged?

@ifplusor
Copy link
Contributor Author

ifplusor commented Apr 25, 2019

Any progress on getting this merged?

@messense this PR is so large, and review is hard. i think we will merge it in next version, and i have more commits that are dependent on this.

@ifplusor ifplusor force-pushed the feature-eventloop branch 2 times, most recently from f5321b2 to eefe849 Compare April 29, 2019 09:39
- feature: use only one event loop for all TcpTransport.
- update: network components.
@ifplusor ifplusor force-pushed the feature-eventloop branch from eefe849 to abb79a4 Compare April 30, 2019 01:59
@ShannonDing ShannonDing merged commit 5689607 into apache:master Jun 12, 2019
@ifplusor ifplusor deleted the feature-eventloop branch June 14, 2019 05:37
hugoasdf pushed a commit to hugoasdf/rocketmq-client-cpp that referenced this pull request Jun 30, 2019
* update network interface.

- feature: use only one event loop for all TcpTransport.
- update: network components.

* remove boost mutex, timed_mutex and condition_variable in TcpRemotingClient, TcpTransport and ReponseFunture.
hugoasdf added a commit to hugoasdf/rocketmq-client-cpp that referenced this pull request Jun 30, 2019
* [ISSUE apache#142] save string::find result into a string::size_type variable.

declare correct string::size_type by auto. (apache#143)

* batch issue

* Update: update network interface. (apache#60)

* update network interface.

- feature: use only one event loop for all TcpTransport.
- update: network components.

* remove boost mutex, timed_mutex and condition_variable in TcpRemotingClient, TcpTransport and ReponseFunture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants