FAQ
I've been learning Go for the last few months, and this is the first
non-trivial project I've tackled. If anyone is interested and has the time,
I'd be very interested in comments and suggestions how to improve.

Source: https://github.com/jjeffery/stomp

Godoc: http://godoc.org/github.com/jjeffery/stomp

There are still a few TODOs, but I anticipate completing the client code in
the near future. The API is pretty stable now. I plan to test against
RabbitMQ shortly. It works against a STOMP server I previously implemented
in C#.

I started this project because I needed a simple in-memory message broker
for an application I worked on a few years ago, and at the time I
implemented it in C# because that is what we used for the rest of the
application. Go seemed like a great language for this kind of application,
and I must say that I have enjoyed using Go for this purpose.

One question I'd appreciate help with is memory usage. When I run a few
instances of the `client_test` program against the STOMP server, its memory
usage quickly goes up to over 500MB on my MacBook (OSX) and stays there. Is
this expected? Any tips on how to see where the memory is being used?

Regards -- John

--

Search Discussions

  • Matthew Holt at Jan 3, 2014 at 4:23 pm
    Better late than never: Thank you for this!
    On Friday, January 11, 2013 7:24:49 PM UTC-7, John Jeffery wrote:

    I've been learning Go for the last few months, and this is the first
    non-trivial project I've tackled. If anyone is interested and has the time,
    I'd be very interested in comments and suggestions how to improve.

    Source: https://github.com/jjeffery/stomp

    Godoc: http://godoc.org/github.com/jjeffery/stomp

    There are still a few TODOs, but I anticipate completing the client code
    in the near future. The API is pretty stable now. I plan to test against
    RabbitMQ shortly. It works against a STOMP server I previously implemented
    in C#.

    I started this project because I needed a simple in-memory message broker
    for an application I worked on a few years ago, and at the time I
    implemented it in C# because that is what we used for the rest of the
    application. Go seemed like a great language for this kind of application,
    and I must say that I have enjoyed using Go for this purpose.

    One question I'd appreciate help with is memory usage. When I run a few
    instances of the `client_test` program against the STOMP server, its memory
    usage quickly goes up to over 500MB on my MacBook (OSX) and stays there. Is
    this expected? Any tips on how to see where the memory is being used?

    Regards -- John
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • James Bardin at Jan 3, 2014 at 4:47 pm

    On Friday, January 11, 2013 9:24:49 PM UTC-5, John Jeffery wrote:
    One question I'd appreciate help with is memory usage. When I run a few
    instances of the `client_test` program against the STOMP server, its memory
    usage quickly goes up to over 500MB on my MacBook (OSX) and stays there. Is
    this expected? Any tips on how to see where the memory is being used?
    Looking at the system memory usage doesn't tell you much without profiling
    (http://blog.golang.org/profiling-go-programs to start).

    It's common for this type of program to create a ton of garbage. I haven't
    looked through your code, but you may be able to reduce the amount of
    garbage by making sure you're not doing extra allocations with
    string<->[]byte conversions for a quick win. IIRC, the nsq message broker
    written in Go uses an internal allocator to reuse objects and reduce GC
    load.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • John Jeffery at Jan 4, 2014 at 3:43 am
    Thanks James.

    I read a thread in this group along the lines that the go runtime never
    returns memory to the OS, and this seems to be what is happening. If the
    STOMP server experiences high load it needs lots of memory. Once the load
    is handled and after the GC has tidied up, the memory is not returned to
    the OS. At least I think that is what is happening.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • James Bardin at Jan 6, 2014 at 4:19 pm

    On Fri, Jan 3, 2014 at 10:43 PM, John Jeffery wrote:

    I read a thread in this group along the lines that the go runtime never
    returns memory to the OS, and this seems to be what is happening. If the
    STOMP server experiences high load it needs lots of memory. Once the load
    is handled and after the GC has tidied up, the memory is not returned to
    the OS. At least I think that is what is happening.


    Only stack memory can't be reclaimed currently, so if high load causes a
    lot of goroutines to be spawned simultaneously, then that memory is going
    to remain fairly static. Heap memory is released periodically, but if you
    end up with 500MB of garbage in spikes between scavenger runs (5 minute
    intervals I think), the system memory will stay pretty high. An easy test
    is just to let the server idle for a while and see what happens.

    Still, if you're getting fairly high throughput for the cost of 500MB
    before profiling, I'd say that's not too bad.

    -jim

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Craig Wickesser at Jan 24, 2014 at 10:33 am
    Does the client support TLS connections? I was randomly looking through
    source files but hadn't seen it (yet?).

    Thanks
    On Monday, January 6, 2014 11:18:57 AM UTC-5, James Bardin wrote:


    On Fri, Jan 3, 2014 at 10:43 PM, John Jeffery <jjef...@sp.com.au<javascript:>
    wrote:
    I read a thread in this group along the lines that the go runtime never
    returns memory to the OS, and this seems to be what is happening. If the
    STOMP server experiences high load it needs lots of memory. Once the load
    is handled and after the GC has tidied up, the memory is not returned to
    the OS. At least I think that is what is happening.


    Only stack memory can't be reclaimed currently, so if high load causes a
    lot of goroutines to be spawned simultaneously, then that memory is going
    to remain fairly static. Heap memory is released periodically, but if you
    end up with 500MB of garbage in spikes between scavenger runs (5 minute
    intervals I think), the system memory will stay pretty high. An easy test
    is just to let the server idle for a while and see what happens.

    Still, if you're getting fairly high throughput for the cost of 500MB
    before profiling, I'd say that's not too bad.

    -jim

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • John Jeffery at Jan 24, 2014 at 10:31 am
    No, TLS connections are not supported yet.

    If this is something you need to do right now, you could establish your own
    connection with the server, and then pass a ReaderWriterCloser to the
    Conn.Connect method (http://godoc.org/github.com/jjeffery/stomp#Connect).
    On Friday, 24 January 2014 20:25:37 UTC+10, Craig Wickesser wrote:

    Does the client support TLS connections? I was randomly looking through
    source files but hadn't seen it (yet?).

    Thanks
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 12, '13 at 4:14a
activeJan 24, '14 at 10:33a
posts7
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase