Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvements #2

Merged
merged 1 commit into from
Oct 28, 2015
Merged

Performance improvements #2

merged 1 commit into from
Oct 28, 2015

Conversation

kozlovic
Copy link
Member

  • Add a "garbage collector" that is responsible for invoking an object's "free" callback. The advantage is to move the cost of freeing objects outside of the fast path.
  • Subject, Reply and Payload are now allocated as a single memory block. This reduces the number of malloc/free calls.
  • Introduced a "signal" timer in each subscription to reduce number of signals and contention. This may increase the risk of reaching the number of max pending messages,
    though, so may need some teaking or make it an option.

* Add a "garbage collector" that is responsible for invoking an object's "free" callback. The advantage is to move the cost of freeing objects outside of the fast path.
* Subject, Reply and Payload are now allocated as a single memory block. This reduces the number of malloc/free calls.
* Introduced a "signal" timer in each subscription to reduce number of signals and contention. This may increase the risk of reaching the number of max pending messages,
though, so may need some teaking or make it an option.
kozlovic added a commit that referenced this pull request Oct 28, 2015
@kozlovic kozlovic merged commit ff01917 into master Oct 28, 2015
@kozlovic kozlovic deleted the pooling-and-gc branch October 28, 2015 00:47
kozlovic pushed a commit that referenced this pull request Sep 20, 2018
levb added a commit that referenced this pull request Jun 7, 2023
levb added a commit that referenced this pull request Jun 14, 2023
* WIP: A skeleton microservice object

* Responds to a PING

* Clarified - this is NOT a JS thing!

* Renamed the example microservice

* First implementation of the default endpoint

* Sequence calculator service - a working example of multiple endpoints.

* Added support for info, stats, natsError

* refactored with the 'micro' prefix

* fixed includes

* wip custom error handler

* simplified examples

* Fixed leaks, debugged the tests

* Groups

* "Basic" test.

* more tests from go, fixes

* Docs (sans HTML) and some PR feedback (names)

* request handler returns err instead of calling Respond(Error)

* Reworked how endpoints are stores in servbice, refcounting

* fixed copyright messages

* PR feedback: fixes in examples

* PR feedback: removed redundant include mem.h

* PR Feedback: use `size_t` and `natsSubscription_GetSubject`

* PR feedback: initialize decoded_len

* PR feedback: removed err->message silliness

* PR feedback: cast size_t to int calling natsMsg_Create

* Ref counting fixes

* PR feedback: strdup-ed strings in Info and Stats

* Fixed NULL pointer crashes in the previous commit

* PR feedback: micro_new_endpoint: check if endpoint config is NULL

* PR feedback: missing unlocks

* PR feedback: use natsBuf_AppendByte where appropriate

* PR feedback: CamelCased remaining public fields

* Added support for multiple handlers for ConnectionClosed and AsyncError callback events.

Added a nats_CallbackList internal type, use it for closed and error cases.
Removed prior code for natsConn_get/setXXXCallback.
Cleaned up access to other callbacks in conn.c (lock opts).

* added is_internal to microError to avoid freeing internal values

* PR feedback: initialize  to avoid a warning

* Removed the never-implemented schema

* PR feedback: added a missing FREE(replaced)

* PR feedback: free the replaced value in SetErrorHandler and SetClosedCB

* reversed: previous (free the replaced value...), added a test

* PR feedback: whitespace

* PR feedback: nit - added natsOptions_(un)lock

* PR feedback: hopefully fixes all windows warnings

* PR feedback: hopefully fixes all windows warnings

* PR feedback: removed previous PR, wrong branch

* restored LOCK_OPTIONS macros

* `Done` handler

* printf

* Added Test_MicroAsyncErrorHandler

* PR feedback: warnings

* Fixed AsyncErr test

* Now with a Done handler to fix the test on gcc builds

* try-1

correct fix?

wip

minimized list.txt

minimized list.txt

minimized list.txt

wip

wip more

wip more+

wip more+oops

wip more+oops+printf

* wip

* wip

* wip2

* wip3

* wip4

* wip5

* reworked wip

* reworked wip2

* reworked wip3

* reworked wip4

* reworked wip5

* reworked wip5

* reworked wip6

* reworked wip7

* reworked wip8

* reworked wip9

* reworked wip10

* reworked wip11

* reworked wip12

* reworked wip13

* reworked wip14

* reworked wip15

* wip nits

* wip more nits

* Moving global variables inside natsLib for proper cleanup on close

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>

* PR feedback sans global elimination

* Restored num_services=5 in tests

* PR feedback: microError.message

* PR feedback: nats_vsnprintf

* PR feedback: nats_vsnprintf, #2

* [CHANGED] More verbose endpoint INFO (#663)

* More verbose endpoint INFO

* better clone/free for metadata

* (valgrind) free test JSON array

* PR feedback: unsed var

* Fix to run on Windows

The change that I asked to make earlier regarding nats_vsnprint
in some places was wrong, but more importantly, you can't pass
a NULL buffer on Windows in order to calculate the length of
the formatted string. Instead, I added a new macro that uses
a different function for Windows.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>

---------

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Co-authored-by: Lev Brouk <levbrouk@levs-mbp-2.lan>
Co-authored-by: Ivan Kozlovic <ivan@synadia.com>
kozlovic pushed a commit that referenced this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant