Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
312ac44
Changed ACA's openflow version from 1.3 to 1.0
zzxgzgz Oct 11, 2021
2a06e33
Added tunnel_id printout, and commented out some unused code
zzxgzgz Oct 18, 2021
3e2855d
Try to make packet out to the bridge based on the of_connection_id
zzxgzgz Oct 19, 2021
3b9185c
Changed more code to let packet out based on of_connection_i
zzxgzgz Oct 19, 2021
329132c
Changed implementation for adding/removing switches in of_controller,…
zzxgzgz Oct 20, 2021
a6b7697
Try to make on-demand packet_out based on the connection_id, rather t…
zzxgzgz Oct 20, 2021
75cc958
Added logs, in order to investigate why ofconnection dropped
zzxgzgz Oct 22, 2021
1964af9
Suspect removing switches with empty name causes the problem
zzxgzgz Oct 22, 2021
5d27e89
Modifed arp_responder to avoid calling NCM
zzxgzgz Oct 26, 2021
28ff285
Added local map lookup
zzxgzgz Oct 26, 2021
7dea624
Initiate marl integration for packet-in stress testing
lfu-ps Dec 22, 2021
bccd5f5
Move libfluid packet-in parsing also to async scheduler, to release m…
lfu-ps Dec 23, 2021
42716a1
Break parse ARP job
lfu-ps Dec 23, 2021
ec1a842
Test setting specific worker thread number
lfu-ps Dec 23, 2021
1c6659f
Do not break parse job but set specific worker size
lfu-ps Jan 4, 2022
2664956
Try to make atomic counter for packet_in
zzxgzgz Jan 5, 2022
dbdfcef
Try to make atomic counter for packet_in
zzxgzgz Jan 5, 2022
da761c3
Try to make atomic counter for packet_in
zzxgzgz Jan 5, 2022
72a5d46
Try to make atomic counter for packet_in
zzxgzgz Jan 5, 2022
416b3dc
Try to make atomic counter for packet_in
zzxgzgz Jan 5, 2022
5c4c36c
Try to make atomic counter for packet_in
zzxgzgz Jan 5, 2022
8241bff
Added sleep 100 us in marl code when packet in
zzxgzgz Jan 5, 2022
975df7d
Added packet_out_counter, also made the counters global
zzxgzgz Jan 5, 2022
a4d7e36
Added packet_out_counter, also made the counters global
zzxgzgz Jan 5, 2022
636fbf8
Print out both counters every 1 second
zzxgzgz Jan 5, 2022
89b634d
Commented out arp_recv and see if the bottleneck is in the on-demand …
zzxgzgz Jan 5, 2022
5ee0437
Changed packet_out_counter++ to the start of parse_packet, then retur…
zzxgzgz Jan 6, 2022
777bec9
Changed packet_out_counter++ to the start of parse_packet, then retur…
zzxgzgz Jan 6, 2022
ec1a2a7
Change it to right inside the arp ether type
zzxgzgz Jan 6, 2022
6d1bcfc
Change it to before arp ether type
zzxgzgz Jan 6, 2022
393050f
Change it to before vlan ether type
zzxgzgz Jan 6, 2022
5072919
Change it to before
zzxgzgz Jan 6, 2022
f78c751
Commented out ACA_LOG_INFOs on the packet_in to packet_out path
zzxgzgz Jan 6, 2022
262a54d
Confirm on_demand_engine is already fast
zzxgzgz Jan 6, 2022
c8adc01
Put the count into the arp_recv
zzxgzgz Jan 6, 2022
0e68150
Put the count into the arp_recv
zzxgzgz Jan 6, 2022
ba1a2db
Added fmt library and sample fmt code
zzxgzgz Jan 6, 2022
8d67fe2
Set counter before sprintf to get a baseline for comparison
zzxgzgz Jan 6, 2022
093d563
Set counter before sprintf to get a baseline for comparison
zzxgzgz Jan 6, 2022
d1542cd
Set counter before sprintf to get a baseline for comparison
zzxgzgz Jan 6, 2022
4ccc709
Set counter after 5 sprintf and string.append
zzxgzgz Jan 6, 2022
1e4f944
Set counter after 5 sprintf and string.append
zzxgzgz Jan 6, 2022
d7b0574
set counter after for loops
zzxgzgz Jan 6, 2022
64c4626
set counter after if statement
zzxgzgz Jan 6, 2022
65f8f23
set counter before return
zzxgzgz Jan 6, 2022
55347bc
_serialize_arp_message isn't a bottleneck?
zzxgzgz Jan 6, 2022
4b633b2
have to do it again with 4 switches in cbench
zzxgzgz Jan 6, 2022
ab932a2
after first five sprintf and string.append
zzxgzgz Jan 6, 2022
1cf9a3a
after for loops
zzxgzgz Jan 6, 2022
4c96380
before return
zzxgzgz Jan 6, 2022
2926e15
Try to rewrite _serialize_arp_message with fmt code
zzxgzgz Jan 6, 2022
411a4f2
try to call condense format_to to fewer ones
zzxgzgz Jan 6, 2022
b313280
comment out append to see if it takes a lot of time
zzxgzgz Jan 6, 2022
2e47718
Try to use FMT_COMPILE when calling format_to
zzxgzgz Jan 6, 2022
cc50820
do test with fmt
zzxgzgz Jan 6, 2022
4bce071
Check qps before packet out
zzxgzgz Jan 6, 2022
84fe31b
let packet out go and test again
zzxgzgz Jan 6, 2022
f5b3802
Comment out time recording and test again
zzxgzgz Jan 6, 2022
28e4894
put counter before is_found
zzxgzgz Jan 6, 2022
f9ddf46
put counter at the beginning of packet_out
zzxgzgz Jan 6, 2022
94d8e3d
add packet out counter to packet out
zzxgzgz Jan 6, 2022
6e5b596
place counter in ofcontroller::packet_out
zzxgzgz Jan 6, 2022
6af4b6d
place counter in create_packet_out
zzxgzgz Jan 6, 2022
a76e587
place counter in create_packet_out
zzxgzgz Jan 6, 2022
4a55014
place counter in create_packet_out
zzxgzgz Jan 6, 2022
9f95413
place counter in create_packet_out
zzxgzgz Jan 6, 2022
a80bb80
place counter in create_packet_out
zzxgzgz Jan 6, 2022
b57e463
place counter in create_packet_out
zzxgzgz Jan 6, 2022
20d4fed
place counter in create_packet_out
zzxgzgz Jan 6, 2022
1b7ff1c
place counter in create_packet_out
zzxgzgz Jan 6, 2022
51f3ec9
place counter in create_packet_out
zzxgzgz Jan 6, 2022
86e5cd5
testing without std::move
zzxgzgz Jan 7, 2022
5e6f6e1
testing without std::move
zzxgzgz Jan 7, 2022
dd54552
remove lock
zzxgzgz Jan 7, 2022
e08c8dc
put counter after create_packet_out
zzxgzgz Jan 7, 2022
e20248e
put counter after send_packet_out
zzxgzgz Jan 7, 2022
1b99814
use marl to send packet out
zzxgzgz Jan 7, 2022
246fcf7
added marl code to BaseOFConnection::send
zzxgzgz Jan 7, 2022
962298f
Disabled marl scheduling for OFConnection
zzxgzgz Jan 10, 2022
7b16f17
try to send flow_mod when receiving a packet_in
zzxgzgz Jan 10, 2022
423e74e
enabled send packet out again, and test if cbench's OFPT_VENDOR shoul…
zzxgzgz Jan 10, 2022
c9fef85
use marl to send flow_mod
zzxgzgz Jan 10, 2022
a0c27ff
test parse_packet with marl
zzxgzgz Jan 11, 2022
a58dff7
Bring back gRPC client/server for testing
zzxgzgz Jan 11, 2022
a9f5dca
Reverted OF version from 1.0 to 1.3
zzxgzgz Jan 11, 2022
a7b5396
comment out set ports' vlan tag for testing
zzxgzgz Jan 11, 2022
6e9a984
bring back adding getting ovs connections with bridge name
zzxgzgz Jan 12, 2022
98fb35f
added logs to investigate why no ovs flows are set up
zzxgzgz Jan 13, 2022
e414c58
modified of message version
zzxgzgz Jan 13, 2022
6056a5e
commented out logs and time calculations to speed up the gs processing
zzxgzgz Jan 13, 2022
5afb161
Try to use marl to update neighbor states
zzxgzgz Jan 13, 2022
9028989
Try to use marl to manage the whole gRPC server, so that update neigh…
zzxgzgz Jan 13, 2022
0db49e6
Added waitGroup.wait()
zzxgzgz Jan 13, 2022
2ed23b6
Check what should be the size of the wait group
zzxgzgz Jan 13, 2022
49943d6
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
03fee9f
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
d35190c
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
24f9634
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
f28c5d0
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
dc8536b
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
0fdfe1d
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
0fd2440
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
f2832fd
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
d70af88
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
3ce3242
Check what should be the size of the wait group
zzxgzgz Jan 14, 2022
80947e1
Use neighbor_count as waitGroup count; also changed back to for each …
zzxgzgz Jan 19, 2022
5d2a30a
try not to use defer()
zzxgzgz Jan 19, 2022
b0bc9be
add one in waitgroup when iter through 1 neighbor
zzxgzgz Jan 19, 2022
7c33069
Try to use barrier request/reply to check neighbor procecssing time
zzxgzgz Jan 19, 2022
d8fa338
added endl to printout
zzxgzgz Jan 19, 2022
e36b80a
Try to send barrier request at the 950k th neighbor creation
zzxgzgz Jan 19, 2022
0013e0d
Changed to send barrier request at the 970k th neighbor creation
zzxgzgz Jan 19, 2022
b03c611
try to use marl to furthur schedule create l2 neighbor
zzxgzgz Jan 19, 2022
591038b
try to use marl to schedule execute_openflow when create_l2_neighbor
zzxgzgz Jan 20, 2022
1ee51e5
comment out duplicated part
zzxgzgz Jan 20, 2022
438f008
comment out duplicated part
zzxgzgz Jan 20, 2022
b9afb78
comment out extra code
zzxgzgz Jan 20, 2022
c918bfd
revert back changes
zzxgzgz Jan 20, 2022
7711148
enable counter again
zzxgzgz Jan 20, 2022
49d03df
put second counter after assert revision number
zzxgzgz Jan 20, 2022
14c94e9
put second counter after invalid argument checks
zzxgzgz Jan 20, 2022
e9dd31e
increment first counter before marl schedule
zzxgzgz Jan 20, 2022
ba6aeb6
put second counter at the beginning of update_neighbor_state_workitem
zzxgzgz Jan 20, 2022
bf2ceb5
Improve performance by reducing unnecessary syslogs
lfu-ps Jan 21, 2022
62f38b0
Use marl::schedule to process netowrk resource states
zzxgzgz Jan 21, 2022
889e0f1
Merge branch 'marl_fully_async_packet_in' of https://github.com/zzxgz…
zzxgzgz Jan 21, 2022
c49986c
added waitgroup to marl::schedule
zzxgzgz Jan 21, 2022
8dbd687
added marl::schedule to on-demand engine
zzxgzgz Jan 21, 2022
e1b50bb
bring back original _parse_arp_request, in order to test with NCM
zzxgzgz Jan 21, 2022
4f27854
add changes from #272
zzxgzgz Jan 21, 2022
713067c
Reverted ACA_ARP_Responder::_serialize_arp_message
zzxgzgz Jan 24, 2022
a01b0df
try to merge from master
zzxgzgz Jan 24, 2022
b1fa8cb
Cleaned up code
zzxgzgz Jan 24, 2022
24ba862
Cleaned up more code
zzxgzgz Jan 25, 2022
2952ffe
Changed multiple logs from INFO to DEBUG
zzxgzgz Jan 25, 2022
3186ac0
Add marl dependencies in cmake as well as machine init script
lfu-ps Jan 25, 2022
0232067
Fix marl dependency location in test cmake
lfu-ps Jan 25, 2022
f8dcae1
Fix docker file marl dependency
lfu-ps Jan 25, 2022
3318ad7
Fix spaces
lfu-ps Jan 25, 2022
24bc813
removed fmt library related code
zzxgzgz Jan 25, 2022
c054ff5
corrected comment about OpenFlow Version
zzxgzgz Jan 25, 2022
5b59700
Tried to fix the memory leak
zzxgzgz Jan 25, 2022
0b87417
fixed blank lines and identation
zzxgzgz Jan 25, 2022
bbc5271
Always restart AlcorControlAgent with new build, and set default debu…
lfu-ps Jan 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alcor
Submodule alcor updated 1508 files
11 changes: 11 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,14 @@ RUN echo "6--- installing pulsar dependacies ---" && \
apt install -y ./apache-pulsar-client*.deb && \
rm -rf /var/local/git/pulsar

RUN echo "7--- installing marl ---" && \
mkdir -p /var/local/git/marl && \
cd /var/local/git/marl && \
git clone https://github.com/google/marl.git && \
cd /var/local/git/marl/marl && \
git submodule update --init && \
mkdir /var/local/git/marl/marl/build && \
cd /var/local/git/marl/marl/build && \
cmake .. -DMARL_BUILD_EXAMPLES=1 -DMARL_BUILD_TESTS=1 && \
make && \
cd ~
27 changes: 21 additions & 6 deletions build/aca-machine-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,20 @@ echo "6--- installing openvswitch dependancies ---" && \
test -f /usr/bin/ovs-vsctl && rm -rf /usr/local/sbin/ov* /usr/local/bin/ov* /usr/local/bin/vtep* && \
cd ~

echo "7--- installing marl ---" && \
mkdir -p /var/local/git/marl && \
cd /var/local/git/marl && \
git clone https://github.com/google/marl.git && \
cd /var/local/git/marl/marl && \
git submodule update --init && \
mkdir /var/local/git/marl/marl/build && \
cd /var/local/git/marl/marl/build && \
cmake .. -DMARL_BUILD_EXAMPLES=1 -DMARL_BUILD_TESTS=1 && \
make && \
cd ~

PULSAR_RELEASE_TAG='pulsar-2.8.1'
echo "7--- installing pulsar dependacies ---" && \
echo "8--- installing pulsar dependacies ---" && \
mkdir -p /var/local/git/pulsar && \
wget https://archive.apache.org/dist/pulsar/${PULSAR_RELEASE_TAG}/DEB/apache-pulsar-client.deb -O /var/local/git/pulsar/apache-pulsar-client.deb && \
wget https://archive.apache.org/dist/pulsar/${PULSAR_RELEASE_TAG}/DEB/apache-pulsar-client-dev.deb -O /var/local/git/pulsar/apache-pulsar-client-dev.deb && \
Expand All @@ -209,20 +221,23 @@ echo "7--- installing pulsar dependacies ---" && \
rm -rf /var/local/git/pulsar
cd ~

echo "8--- building alcor-control-agent"
echo "9--- building alcor-control-agent"
cd $BUILD/.. && cmake . && \
# after cmake ., modify the generated link.txt s so that the "-lssl" and "-lcrypto" appears after the openvswitch, so that it can compile
sed -i 's/\(-ldl -lrt -lm -lpthread\)/-lssl -lcrypto \1/' src/CMakeFiles/AlcorControlAgent.dir/link.txt && \
sed -i 's/\(-ldl -lrt -lm -lpthread\)/-lssl -lcrypto \1/' test/CMakeFiles/aca_tests.dir/link.txt && \
sed -i 's/\(-ldl -lrt -lm -lpthread\)/-lssl -lcrypto \1/' test/CMakeFiles/gs_tests.dir/link.txt && \
make
if [ -n "$1" -a "$1" = "delete-bridges" ]; then
echo "9--- deleting br-tun and br-int if requested"
echo "10--- deleting br-tun and br-int if requested"
PATH=$PATH:/usr/local/share/openvswitch/scripts \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
ovs-ctl --system-id=random --delete-bridges restart
fi

echo "10--- running alcor-control-agent"
# sends output to null device, but stderr to console
nohup $BUILD/bin/AlcorControlAgent -d > /dev/null 2>&1 &
echo "11--- running alcor-control-agent"
# kill current AlcorControlAgent process if any
pkill -f AlcorControlAgent
# launch newly built AlcorControlAgent with default debug mode as 'false'
# sends output to null device, but stderr to console
nohup $BUILD/bin/AlcorControlAgent > /dev/null 2>&1 &
29 changes: 13 additions & 16 deletions include/aca_on_demand_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
#define STDOUT_FILENO 1 /* Standard output. */

#include "common.pb.h"
#include <openvswitch/ofp-errors.h>
//#include <openvswitch/ofp-packet.h>
#include <openvswitch/ofp-util.h>
#include "libfluid-msg/of10msg.hh"
#include "libfluid-msg/of13msg.hh"
#include <string>
#include <thread>
#include <netinet/ether.h>
Expand All @@ -31,11 +30,14 @@
#include <unordered_map>
#include "aca_log.h"
#include "goalstateprovisioner.grpc.pb.h"
#include "ctpl/ctpl_stl.h"

#include "marl/defer.h"
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"

using namespace alcor::schema;
using namespace std;
using namespace ctpl;

extern int thread_pools_size;

Expand Down Expand Up @@ -74,8 +76,6 @@ class ACA_On_Demand_Engine {
its initial value should be the time when clean_remaining_payload() was first called*/
std::chrono::_V2::steady_clock::time_point last_time_cleaned_remaining_payload;

ctpl::thread_pool thread_pool_;

static ACA_On_Demand_Engine &get_instance();

/*
Expand Down Expand Up @@ -175,22 +175,19 @@ class ACA_On_Demand_Engine {
int cores = std::thread::hardware_concurrency();
ACA_LOG_DEBUG("This host has %ld cores, setting the size of the thread pools to be %ld\n",
cores, thread_pools_size);
on_demand_reply_processing_thread = new std::thread(
std::bind(&ACA_On_Demand_Engine::process_async_grpc_replies, this));

on_demand_reply_processing_thread->detach();
on_demand_payload_cleaning_thread = new std::thread(
std::bind(&ACA_On_Demand_Engine::clean_remaining_payload, this));
on_demand_payload_cleaning_thread->detach();
thread_pool_.resize(thread_pools_size);
marl::schedule([=]{
process_async_grpc_replies();
});
marl::schedule([=]{
clean_remaining_payload();
});
};
~ACA_On_Demand_Engine()
{
_cq.Shutdown();
request_uuid_on_demand_payload_map.clear();
delete on_demand_reply_processing_thread;
delete on_demand_payload_cleaning_thread;
thread_pool_.stop();
};
};
} // namespace aca_on_demand_engine
Expand Down
6 changes: 5 additions & 1 deletion include/libfluid-base/base/EventLoop.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#ifndef __EVENTLOOP_HH__
#define __EVENTLOOP_HH__

#include "marl/defer.h"
#include "marl/scheduler.h"

namespace fluid_base {

class BaseOFServer;
Expand All @@ -41,7 +44,7 @@ public:

@param id event loop id
*/
EventLoop(int id);
EventLoop(int id, marl::Scheduler* scheduler);
~EventLoop();

/**
Expand Down Expand Up @@ -80,6 +83,7 @@ private:
class LibEventEventLoop;
friend class LibEventEventLoop;
LibEventEventLoop* m_implementation;
marl::Scheduler* m_scheduler;
};

}
Expand Down
14 changes: 12 additions & 2 deletions include/of_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#include "libfluid-msg/of10msg.hh"
#include "libfluid-msg/of13msg.hh"

#include "marl/defer.h"
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"

#include <arpa/inet.h>
#include <atomic>
#include <vector>
Expand All @@ -40,6 +45,8 @@
#include <set>
#include <stdlib.h>
#include <unordered_map>
#include <chrono>


using namespace fluid_base;
using namespace fluid_msg;
Expand All @@ -56,8 +63,10 @@ class OFController : public OFServer {
switch_dpid_map(switch_dpid_map),
port_id_map(port_id_map),
OFServer(address, port, nthreads, secure,
OFServerSettings().supported_version(4) // OF version 0x04 is OF 1.3
.echo_interval(30)) { }
OFServerSettings()
.supported_version(4) // OF version 1 is OF 1.0 and version 4 is 1.3
.echo_interval(30)) {
}

~OFController() = default;

Expand Down Expand Up @@ -86,6 +95,7 @@ class OFController : public OFServer {
void packet_out(const char* br, const char* opt);

private:

// tracking xid (ovs transaction id)
std::atomic<uint32_t> xid;

Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ link_libraries(/usr/lib/x86_64-linux-gnu/libuuid.so)
link_libraries(/usr/lib/x86_64-linux-gnu/libevent_pthreads.so)
link_libraries(/usr/lib/x86_64-linux-gnu/libpthread.so)
link_libraries(/usr/local/lib/libopenvswitch.a) #this was installed by aca-machine-init.sh
link_libraries(/var/local/git/marl/marl/build/libmarl.a) #this was built by aca-machine-init.sh
include_directories(${RDKAFKA_INCLUDE_DIR} ${CPPKAFKA_INCLUDE_DIR} ${PULSAR_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/proto3)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/grpc)
include_directories(/usr/local/include/openvswitch)
include_directories(/usr/local/include/openflow)
include_directories(/var/local/git/marl/marl/include)

# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
Expand Down
30 changes: 23 additions & 7 deletions src/aca_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
#include <grpcpp/grpcpp.h>
#include <cmath>

#include "marl/defer.h"
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"

using aca_message_pulsar::ACA_Message_Pulsar_Consumer;
using aca_ovs_control::ACA_OVS_Control;
using std::string;
Expand Down Expand Up @@ -240,6 +245,7 @@ int main(int argc, char *argv[])
}
}


// fill in the information if not provided in command line args
if (g_broker_list == EMPTY_STRING) {
g_broker_list = BROKER_LIST;
Expand All @@ -261,15 +267,25 @@ int main(int argc, char *argv[])
}

g_grpc_server = new GoalStateProvisionerAsyncServer();
g_grpc_server_thread = new std::thread(std::bind(
&GoalStateProvisionerAsyncServer::RunServer, g_grpc_server, thread_pools_size));
g_grpc_server_thread->detach();


// Create a separate thread to run the grpc client.
g_grpc_client = new GoalStateProvisionerClientImpl();
g_grpc_client_thread = new std::thread(
std::bind(&GoalStateProvisionerClientImpl::RunClient, g_grpc_client));
g_grpc_client_thread->detach();

// Create a marl scheduler using all the logical processors available to the process.
// Bind this scheduler to the main thread so we can call marl::schedule()
marl::Scheduler::Config cfg_bind_hw_cores;
cfg_bind_hw_cores.setWorkerThreadCount(thread_pools_size * 2);
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 made the worker thread count to be thread_pool_size * 2, instead of a fixed number.

marl::Scheduler task_scheduler(cfg_bind_hw_cores);
task_scheduler.bind();
defer(task_scheduler.unbind());

marl::schedule([=]{
g_grpc_server->RunServer(thread_pools_size);
});

marl::schedule([=]{
g_grpc_client->RunClient();
});

aca_ovs_l2_programmer::ACA_OVS_L2_Programmer::get_instance().get_local_host_ips();

Expand Down
20 changes: 9 additions & 11 deletions src/comm/aca_grpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
#include "aca_log.h"
#include "aca_grpc.h"

#include "marl/defer.h"
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"

extern string g_grpc_server_port;
extern string g_ncm_address;
extern string g_ncm_port;
Expand All @@ -43,7 +48,6 @@ Status GoalStateProvisionerAsyncServer::ShutDownServer()
ACA_LOG_INFO("%s", "Shutdown server");
server_->Shutdown();
cq_->Shutdown();
thread_pool_.stop();
keepReadingFromCq_ = false;
return Status::OK;
}
Expand Down Expand Up @@ -275,15 +279,7 @@ void GoalStateProvisionerAsyncServer::AsyncWorkder()
void GoalStateProvisionerAsyncServer::RunServer(int thread_pool_size)
{
ACA_LOG_INFO("Start of RunServer, pool size %ld\n", thread_pool_size);

thread_pool_.resize(thread_pool_size);
ACA_LOG_DEBUG("Async GRPC SERVER: Resized thread pool to %ld threads, start waiting for the pool to have enough threads\n",
thread_pool_size);
/* wait for thread pool to initialize*/
while (thread_pool_.n_idle() != thread_pool_.size()) {
ACA_LOG_DEBUG("%s\n", "Still waiting...sleep 1 ms");
std::this_thread::sleep_for(std::chrono::milliseconds(1));
};

ACA_LOG_DEBUG("Async GRPC SERVER: finised resizing thread pool to %ld threads\n",
thread_pool_size);
// Create the server
Expand Down Expand Up @@ -331,6 +327,8 @@ void GoalStateProvisionerAsyncServer::RunServer(int thread_pool_size)

for (int i = 0; i < thread_pool_size; i++) {
ACA_LOG_DEBUG("Pushing the %ldth async worker into the pool", i);
thread_pool_.push(std::bind(&GoalStateProvisionerAsyncServer::AsyncWorkder, this));
marl::schedule([=]{
AsyncWorkder();
});
}
}
20 changes: 8 additions & 12 deletions src/dp_abstraction/aca_dataplane_ovs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ int ACA_Dataplane_OVS::update_port_state_workitem(const PortState current_PortSt
culminative_network_configuration_time, operation_total_time);

if (overall_rc == EXIT_SUCCESS) {
ACA_LOG_INFO("%s", "Successfully configured the port state.\n");
ACA_LOG_DEBUG("%s", "Successfully configured the port state.\n");
} else if (overall_rc == EINPROGRESS) {
ACA_LOG_INFO("Port state returned pending: rc=%d\n", overall_rc);
ACA_LOG_DEBUG("Port state returned pending: rc=%d\n", overall_rc);
} else {
ACA_LOG_ERROR("Unable to configure the port state: rc=%d\n", overall_rc);
}
Expand Down Expand Up @@ -541,9 +541,9 @@ int ACA_Dataplane_OVS::update_port_state_workitem(const PortState current_PortSt
culminative_network_configuration_time, operation_total_time);

if (overall_rc == EXIT_SUCCESS) {
ACA_LOG_INFO("%s", "Successfully configured the port state.\n");
ACA_LOG_DEBUG("%s", "Successfully configured the port state.\n");
} else if (overall_rc == EINPROGRESS) {
ACA_LOG_INFO("Port state returned pending: rc=%d\n", overall_rc);
ACA_LOG_DEBUG("Port state returned pending: rc=%d\n", overall_rc);
} else {
ACA_LOG_ERROR("Unable to configure the port state: rc=%d\n", overall_rc);
}
Expand Down Expand Up @@ -730,9 +730,7 @@ int ACA_Dataplane_OVS::update_neighbor_state_workitem(NeighborState current_Neig
overall_rc, culminative_dataplane_programming_time,
culminative_network_configuration_time, operation_total_time);

if (overall_rc == EXIT_SUCCESS) {
ACA_LOG_INFO("%s", "Successfully configured the neighbor state.\n");
} else {
if (overall_rc != EXIT_SUCCESS) {
ACA_LOG_ERROR("Unable to configure the neighbor state: rc=%d\n", overall_rc);
}

Expand Down Expand Up @@ -907,9 +905,7 @@ int ACA_Dataplane_OVS::update_neighbor_state_workitem(NeighborState current_Neig
overall_rc = -EFAULT;
}

if (overall_rc == EXIT_SUCCESS) {
ACA_LOG_INFO("%s", "Successfully configured the neighbor state.\n");
} else {
if (overall_rc != EXIT_SUCCESS) {
ACA_LOG_ERROR("Unable to configure the neighbor state: rc=%d\n", overall_rc);
}

Expand Down Expand Up @@ -965,7 +961,7 @@ int ACA_Dataplane_OVS::update_router_state_workitem(RouterState current_RouterSt
culminative_network_configuration_time, operation_total_time);

if (overall_rc == EXIT_SUCCESS) {
ACA_LOG_INFO("%s", "Successfully configured the router state.\n");
ACA_LOG_DEBUG("%s", "Successfully configured the router state.\n");
} else {
ACA_LOG_ERROR("Unable to configure the router state: rc=%d\n", overall_rc);
}
Expand Down Expand Up @@ -1022,7 +1018,7 @@ int ACA_Dataplane_OVS::update_router_state_workitem(RouterState current_RouterSt
culminative_network_configuration_time, operation_total_time);

if (overall_rc == EXIT_SUCCESS) {
ACA_LOG_INFO("%s", "Successfully configured the router state.\n");
ACA_LOG_DEBUG("%s", "Successfully configured the router state.\n");
} else {
ACA_LOG_ERROR("Unable to configure the router state: rc=%d\n", overall_rc);
}
Expand Down
Loading