mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Finetuning communication CPU usage.
This commit is contained in:
parent
0208dd2844
commit
51009b73bc
3 changed files with 16 additions and 1 deletions
|
@ -44,7 +44,7 @@ event bro_init() &priority=9
|
||||||
{
|
{
|
||||||
if ( n$node_type == WORKER && n$proxy == node )
|
if ( n$node_type == WORKER && n$proxy == node )
|
||||||
Communication::nodes[i] =
|
Communication::nodes[i] =
|
||||||
[$host=n$ip, $connect=F, $class=i, $sync=T, $auth=T, $events=worker2proxy_events];
|
[$host=n$ip, $connect=F, $class=i, $sync=F, $auth=T, $events=worker2proxy_events];
|
||||||
|
|
||||||
# accepts connections from the previous one.
|
# accepts connections from the previous one.
|
||||||
# (This is not ideal for setups with many proxies)
|
# (This is not ideal for setups with many proxies)
|
||||||
|
|
|
@ -532,6 +532,7 @@ RemoteSerializer::RemoteSerializer()
|
||||||
terminating = false;
|
terminating = false;
|
||||||
in_sync = 0;
|
in_sync = 0;
|
||||||
last_flush = 0;
|
last_flush = 0;
|
||||||
|
received_logs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteSerializer::~RemoteSerializer()
|
RemoteSerializer::~RemoteSerializer()
|
||||||
|
@ -1353,6 +1354,14 @@ double RemoteSerializer::NextTimestamp(double* local_network_time)
|
||||||
{
|
{
|
||||||
Poll(false);
|
Poll(false);
|
||||||
|
|
||||||
|
if ( received_logs > 0 )
|
||||||
|
{
|
||||||
|
// If we processed logs last time, assume there's more.
|
||||||
|
idle = false;
|
||||||
|
received_logs = 0;
|
||||||
|
return timer_mgr->Time();
|
||||||
|
}
|
||||||
|
|
||||||
double et = events.length() ? events[0]->time : -1;
|
double et = events.length() ? events[0]->time : -1;
|
||||||
double pt = packets.length() ? packets[0]->time : -1;
|
double pt = packets.length() ? packets[0]->time : -1;
|
||||||
|
|
||||||
|
@ -2744,6 +2753,8 @@ bool RemoteSerializer::ProcessLogWrite()
|
||||||
|
|
||||||
fmt.EndRead();
|
fmt.EndRead();
|
||||||
|
|
||||||
|
++received_logs;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -3385,6 +3396,9 @@ void SocketComm::Run()
|
||||||
small_timeout.tv_usec =
|
small_timeout.tv_usec =
|
||||||
io->CanWrite() || io->CanRead() ? 1 : 10;
|
io->CanWrite() || io->CanRead() ? 1 : 10;
|
||||||
|
|
||||||
|
if ( ! io->CanWrite() )
|
||||||
|
usleep(10);
|
||||||
|
|
||||||
int a = select(max_fd + 1, &fd_read, &fd_write, &fd_except,
|
int a = select(max_fd + 1, &fd_read, &fd_write, &fd_except,
|
||||||
&small_timeout);
|
&small_timeout);
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,7 @@ private:
|
||||||
int propagate_accesses;
|
int propagate_accesses;
|
||||||
bool ignore_accesses;
|
bool ignore_accesses;
|
||||||
bool terminating;
|
bool terminating;
|
||||||
|
int received_logs;
|
||||||
Peer* source_peer;
|
Peer* source_peer;
|
||||||
PeerID id_counter; // Keeps track of assigned IDs.
|
PeerID id_counter; // Keeps track of assigned IDs.
|
||||||
uint32 current_sync_point;
|
uint32 current_sync_point;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue