From 42bd133238a31815721bab605635486502149d67 Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Thu, 21 Dec 2017 15:27:23 -0800 Subject: [PATCH 1/5] Remove the C++ reactor app --- proton-c/bindings/cpp/CMakeLists.txt | 1 - tests/tools/apps/cpp/CMakeLists.txt | 53 ---------- tests/tools/apps/cpp/reactor_send.cpp | 133 -------------------------- 3 files changed, 187 deletions(-) delete mode 100644 tests/tools/apps/cpp/CMakeLists.txt delete mode 100644 tests/tools/apps/cpp/reactor_send.cpp diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt index 6555c4cb01..5d50558f9f 100644 --- a/proton-c/bindings/cpp/CMakeLists.txt +++ b/proton-c/bindings/cpp/CMakeLists.txt @@ -186,7 +186,6 @@ install (DIRECTORY "include/proton" DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MAT install (FILES "${CMAKE_CURRENT_BINARY_DIR}/config_presets.hpp" DESTINATION "${INCLUDE_INSTALL_DIR}/proton/internal") add_subdirectory(docs) -add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp) # Pkg config file configure_file( diff --git a/tests/tools/apps/cpp/CMakeLists.txt b/tests/tools/apps/cpp/CMakeLists.txt deleted file mode 100644 index 2bc1bc5671..0000000000 --- a/tests/tools/apps/cpp/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -include_directories("${CMAKE_SOURCE_DIR}/examples/cpp" "${CMAKE_SOURCE_DIR}/examples/cpp/lib") -add_executable(reactor_send_cpp reactor_send.cpp) - -target_link_libraries(reactor_send_cpp qpid-proton qpid-proton-cpp) - -if (CMAKE_SYSTEM_NAME STREQUAL Windows) - # No change needed for windows already use correct separator - function(to_native_path path result) - file (TO_NATIVE_PATH "${path}" path) - set (${result} ${path} PARENT_SCOPE) - endfunction() -else (CMAKE_SYSTEM_NAME STREQUAL Windows) - # Just change ';'->':' - function(to_native_path path result) - file (TO_NATIVE_PATH "${path}" path) - string (REGEX REPLACE ";" ":" path "${path}") - set (${result} ${path} PARENT_SCOPE) - endfunction() -endif (CMAKE_SYSTEM_NAME STREQUAL Windows) - -set (py_bld "$" "$") # For windows -set (app_path $ $) -set (py_path ${py_bld} ${app_path} $ENV{PATH}) -to_native_path("${py_path}" py_path) -set (py_pythonpath "${CMAKE_SOURCE_DIR}/examples/cpp" $ENV{PYTHONPATH}) -to_native_path ("${py_pythonpath}" py_pythonpath) -set (perf_pythonpath "${py_pythonpath}" "${CMAKE_SOURCE_DIR}/examples/cpp") -to_native_path ("${perf_pythonpath}" perf_pythonpath) - -add_custom_target(quick_perf_cpp ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/proton-c/env.py -- - "PATH=${py_path}" "PYTHONPATH=${perf_pythonpath}" - ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/tests/perf/quick_perf.py" "CPP") - -add_dependencies(quick_perf_cpp reactor_send_cpp reactor-recv qpid-proton-cpp) diff --git a/tests/tools/apps/cpp/reactor_send.cpp b/tests/tools/apps/cpp/reactor_send.cpp deleted file mode 100644 index a80da6ef9b..0000000000 --- a/tests/tools/apps/cpp/reactor_send.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "options.hpp" - -#include "proton/binary.hpp" -#include "proton/codec/decoder.hpp" -#include "proton/connection.hpp" -#include "proton/container.hpp" -#include "proton/delivery.hpp" -#include "proton/message.hpp" -#include "proton/message_id.hpp" -#include "proton/messaging_handler.hpp" -#include "proton/receiver_options.hpp" -#include "proton/sender.hpp" -#include "proton/tracker.hpp" -#include "proton/value.hpp" - -#include -#include -#include -#include -#include - -class reactor_send : public proton::messaging_handler { - private: - std::string url_; - proton::message message_; - std::string reply_to_; - int sent_; - int confirmed_; - int total_; - int received_; - size_t received_bytes_; - proton::binary received_content_; - bool replying_; - proton::message_id id_value_; - public: - - reactor_send(const std::string &url, int c, int size, bool replying) - : url_(url), sent_(0), confirmed_(0), total_(c), - received_(0), received_bytes_(0), replying_(replying) { - if (replying_) - message_.reply_to("localhost/test"); - proton::binary content; - content.assign((size_t) size, 'X'); - message_.body(content); - } - - void on_container_start(proton::container &c) PN_CPP_OVERRIDE { - c.receiver_options(proton::receiver_options().credit_window(1024)); - c.open_sender(url_); - } - - void on_sendable(proton::sender &sender) PN_CPP_OVERRIDE { - while (sender.credit() && sent_ < total_) { - id_value_ = sent_ + 1; - message_.correlation_id(id_value_); - message_.creation_time(proton::timestamp::now()); - sender.send(message_); - sent_++; - } - } - - void on_tracker_accept(proton::tracker &t) PN_CPP_OVERRIDE { - confirmed_++; - t.settle(); - if (confirmed_ == total_) { - std::cout << "all messages confirmed" << std::endl; - if (!replying_) - t.connection().close(); - } - } - - void on_message(proton::delivery &d, proton::message &msg) PN_CPP_OVERRIDE { - received_content_ = proton::get(msg.body()); - received_bytes_ += received_content_.size(); - if (received_ < total_) { - received_++; - } - d.settle(); - if (received_ == total_) { - d.receiver().close(); - d.connection().close(); - } - } - - void on_transport_close(proton::transport &) PN_CPP_OVERRIDE { - sent_ = confirmed_; - } -}; - -int main(int argc, char **argv) { - // Command line options - std::string address("127.0.0.1:5672/cpp_tests"); - int message_count = 10; - int message_size = 100; - bool replying = false; - example::options opts(argc, argv); - opts.add_value(address, 'a', "address", "connect and send to URL", "URL"); - opts.add_value(message_count, 'c', "messages", "send COUNT messages", "COUNT"); - opts.add_value(message_size, 'b', "bytes", "send binary messages BYTES long", "BYTES"); - opts.add_value(replying, 'R', "replying", "process reply messages", "REPLYING"); - try { - opts.parse(); - reactor_send send(address, message_count, message_size, replying); - proton::container(send).run(); - return 0; - } catch (const example::bad_option& e) { - std::cout << opts << std::endl << e.what() << std::endl; - } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; - } - return 1; -} From 1574f3505af06ea94bdbed3e2964b3f66deb4792 Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Thu, 21 Dec 2017 06:32:50 -0800 Subject: [PATCH 2/5] Remove old docs; some of this content will be restored to new locations --- docs/markdown/engine/engine.md | 74 ---------------------------------- docs/markdown/index.md | 24 ----------- 2 files changed, 98 deletions(-) delete mode 100644 docs/markdown/engine/engine.md delete mode 100644 docs/markdown/index.md diff --git a/docs/markdown/engine/engine.md b/docs/markdown/engine/engine.md deleted file mode 100644 index b1a6f60263..0000000000 --- a/docs/markdown/engine/engine.md +++ /dev/null @@ -1,74 +0,0 @@ -Proton's Engine is a stateful component with a low-level API that allows an -application to communicate using AMQP. This document gives a high level overview -of the Engine's design, intended to be read by application developers intending -to use it. - -The Engine is built around the concept of a protocol engine. The idea behind a -protocol engine is to capture all the complex details of implementing a given -protocol in a way that is as decoupled as possible from OS details such as I/O -and threading models. The result is a highly portable and easily embedded -component that provides a full protocol implementation. - - -The Engine API --------------- - -The Engine contains in-memory representations of AMQP entities such as -Connection, Session and Delivery. These are manipulated via its API, which -consists of two main parts. - -- The *control and query API*, commonly referred to as *The Top Half*, which - offers functions to directly create, modify and query the Connections, - Sessions etc. - -- The *transport API*, commonly referred to as *The Bottom Half*, which contains - a small set of functions to operate on the AMQP entities therein by accepting - binary AMQP input and producing binary AMQP output. The Engine's transport - layer can be thought of as transforming a *queue of bytes*, therefore the API - is expressed in terms of input appended to the *tail* and output fetched from - the *head*. - - -Typical Engine usage --------------------- - -The diagram below shows how the Engine is typically used by an application. The -socket's remote peer is serviced by another AMQP application, which may (or may -not) use Proton. - -
-| Engine        |
-                              | business    |          | "Top Half"    |
-                              | logic       |          | Control and   |
-                              |             |<---------| query API     |
-                              |             |          |               |
-                              |             |          +---------------+
-                              |             |                 |
-     +-------------+          +-------------+          +---------------+
-     |             |  Input   |             |  Tail    | Engine        |
-     |             |--------->|             |--------->| "Bottom half" |
-     |   Socket    |          | Application |          | Transport API |
-     |             |<---------| I/O layer   |<---------|               |
-     |             |  Output  |             |  Head    |               |
-     +-------------+          +-------------+          +---------------+
-]]>
-
- -For maximum flexibility, the Engine is not multi-threaded. It is therefore -typical for an application thread to loop continuously, repeatedly calling the -Top Half and Bottom Half functions. - - -Implementations ---------------- - -Implementations of the Engine currently exist in C and Java. Bindings exist from -several languages (e.g. Ruby, Python, Java Native Interface) to the C Engine. - -For more information see the documentation in the code. - - diff --git a/docs/markdown/index.md b/docs/markdown/index.md deleted file mode 100644 index 97ce4f23d4..0000000000 --- a/docs/markdown/index.md +++ /dev/null @@ -1,24 +0,0 @@ - -Proton is a library for speaking AMQP, including: - -- The [AMQP Protocol Engine](engine/engine.html), a succinct encapsulation of the full - AMQP protocol machinery. - -Proton is designed for maximum embeddability: - -- minimal dependencies -- minimal assumptions about application threading model - -Proton is designed to scale up and down: - -- transparently supports both simple peer to peer messaging and complex -globally federated topologies - -Proton is multi-lingual: - -- Proton-C - a C implementation with language bindings in C++, Go, Python, and Ruby -- Proton-J - a pure Java implementation - -Please see http://qpid.apache.org/proton for a more info. - - From fbc9186e8bb9c429ad25a7dcf97d808a3f8f40ed Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Thu, 21 Dec 2017 14:33:49 -0800 Subject: [PATCH 3/5] xproton.py is no longer used --- proton-c/xproton.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 proton-c/xproton.py diff --git a/proton-c/xproton.py b/proton-c/xproton.py deleted file mode 100644 index 8d78660f9e..0000000000 --- a/proton-c/xproton.py +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -from cproton import * From 58289aab37e4bda1ae1ad75a02a08ec7be7ef10f Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Tue, 6 Mar 2018 15:06:36 -0800 Subject: [PATCH 4/5] Remove the reactor-based quick_perf --- proton-c/CMakeLists.txt | 13 ------- tests/perf/README.txt | 10 ------ tests/perf/quick_perf.py | 78 ---------------------------------------- 3 files changed, 101 deletions(-) delete mode 100644 tests/perf/README.txt delete mode 100644 tests/perf/quick_perf.py diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index a6c48ec6db..b3683be6ca 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -795,17 +795,4 @@ if (BUILD_PYTHON) endif () endif (ENABLE_TOX_TEST) endif(NOT TOX_MODULE_FOUND) - - set (perf_pythonpath "${py_pythonpath}" "${CMAKE_SOURCE_DIR}/examples/cpp") - to_native_path ("${perf_pythonpath}" perf_pythonpath) - add_custom_target(quick_perf_c ${env_py} -- "PATH=${py_path}" "PYTHONPATH=${perf_pythonpath}" - ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/tests/perf/quick_perf.py" "C") - add_dependencies(quick_perf_c reactor-send reactor-recv) - - add_custom_target(quick_perf_py COMMAND ${env_py} -- - "PATH=${py_path}" "PYTHONPATH=${perf_pythonpath}" - ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/tests/perf/quick_perf.py" "PYTHON" - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/tests/tools/apps/python") - add_dependencies(quick_perf_py reactor-recv _cproton) - endif (BUILD_PYTHON) diff --git a/tests/perf/README.txt b/tests/perf/README.txt deleted file mode 100644 index 5f01ae999d..0000000000 --- a/tests/perf/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Simple performance tests. - -quick_perf coordinates two processes: a simple fast echo "server" and -a client that sends and receives simple binary messages over a single -connection on the loopback interface. The latter is timed. This -provides a crude view of the overhead of the Proton library alone -(CMake target "quick_perf_c") or with a language binding. It is most -useful for verifying a lack of performance degradation on a large -check-in or between releases. It probably says little about expected -performance on a physical network or for a particular application. diff --git a/tests/perf/quick_perf.py b/tests/perf/quick_perf.py deleted file mode 100644 index 4371fb47f5..0000000000 --- a/tests/perf/quick_perf.py +++ /dev/null @@ -1,78 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License -# - -# For use with CMake to run simple performance tests in Proton. -# Assumes that rector-recv and reactor-send can be found in PATH. -# CMake's choice of python executable may be passed via PYTHON_EXE environment var. -# Add any OS specific monitor helpers in PN_QPERF_MON: i.e. -# PN_QPERF_MON="time taskset 0x2" make quick_perf_c - - -import os, sys, socket, time -from example_test import Proc, pick_addr -from subprocess import Popen, PIPE, STDOUT - - -NULL = open(os.devnull, 'w') - -connaddr = pick_addr() -linkaddr = connaddr + "/perf_test" - -if 'PYTHON_EXE' in os.environ: - python_exe = os.environ['PYTHON_EXE'] -else: - python_exe = 'python' - -if 'PN_QPERF_MON' in os.environ: - monitor_cmd = os.environ['PN_QPERF_MON'].split() -else: - monitor_cmd = [] - - - -mcount = 5000000 -if 'PYTHON' in sys.argv: - mcount /= 10 - -perf_targets = {'C' : ['reactor-send', "-a", linkaddr, "-c", str(mcount), "-R"], - 'CPP' : ['reactor_send_cpp', "-a", linkaddr, "-c", str(mcount), "-R", "1"], - 'PYTHON' : [python_exe, 'reactor-send.py', "-a", linkaddr, "-c", str(mcount), "-R"] } -try: - perf_target = monitor_cmd + perf_targets[sys.argv[1]] -except: - print "Usage: python quick_perf [C|CPP|PYTHON]" - raise - - -# Use Proton-C reactor-recv as a relatively fast loopback "broker" for these tests -server = Proc(["reactor-recv", "-X", "listening", "-a", linkaddr, "-c", str(mcount), "-R"], ready="listening", valgrind=False, timeout=300) -try: - start = time.time() - client = Proc(perf_target, valgrind=False, timeout=300) - print client.wait_exit() - server.wait_exit() - end = time.time() -except Exception as e: - if server: server.safe_kill() - raise Exception("Error running %s: %s", server, e) - - -secs = end - start -print("%d loopback messages in %.1f secs" % (mcount * 2, secs) ) -print("%.0f msgs/sec" % (mcount * 2 / secs) ) From d2bd617eeea29529f00fa16b47717e3b18689308 Mon Sep 17 00:00:00 2001 From: Justin Ross Date: Tue, 6 Mar 2018 15:13:35 -0800 Subject: [PATCH 5/5] Remove the python reactor-send impl --- tests/tools/apps/python/reactor-send.py | 85 ------------------------- 1 file changed, 85 deletions(-) delete mode 100644 tests/tools/apps/python/reactor-send.py diff --git a/tests/tools/apps/python/reactor-send.py b/tests/tools/apps/python/reactor-send.py deleted file mode 100644 index 163015b8ee..0000000000 --- a/tests/tools/apps/python/reactor-send.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -from __future__ import print_function -import optparse -from proton import Message -from proton.handlers import MessagingHandler -from proton.reactor import Container - -class Send(MessagingHandler): - def __init__(self, url, messages, size, replying): - super(Send, self).__init__(prefetch=1024) - self.url = url - self.sent = 0 - self.confirmed = 0 - self.received = 0 - self.received_bytes = 0 - self.total = messages - self.message_size = size; - self.replying = replying; - self.message = Message(body="X" * self.message_size) - if replying: - self.message.reply_to = "localhost/test" - - def on_start(self, event): - event.container.sasl_enabled = False - event.container.create_sender(self.url) - - def on_sendable(self, event): - while event.sender.credit and self.sent < self.total: - self.message.correlation_id = self.sent + 1 - event.sender.send(self.message) - self.sent += 1 - - def on_accepted(self, event): - self.confirmed += 1 - if self.confirmed == self.total: - print("all messages confirmed") - if not self.replying: - event.connection.close() - - def on_message(self, event): - msg = event.message; - if self.received < self.total: - self.received += 1 - self.received_bytes += len(msg.body) - if self.received == self.total: - event.receiver.close() - event.connection.close() - - def on_disconnected(self, event): - self.sent = self.confirmed - -parser = optparse.OptionParser(usage="usage: %prog [options]", - description="Send messages to the supplied address.") -parser.add_option("-a", "--address", default="localhost:5672/examples", - help="address to which messages are sent (default %default)") -parser.add_option("-c", "--messages", type="int", default=100, - help="number of messages to send (default %default)") -parser.add_option("-b", "--bytes", type="int", default=100, - help="size of each message body in bytes (default %default)") -parser.add_option("-R", action="store_true", dest="replying", help="process reply messages") - -opts, args = parser.parse_args() - -try: - Container(Send(opts.address, opts.messages, opts.bytes, opts.replying)).run() -except KeyboardInterrupt: pass