[rabbitmq-discuss] Java Client + Android

John Apps johndapps at gmail.com
Tue Jun 15 08:31:26 BST 2010


This is probably way off the mark, and something you have sure to have
tried: changing the GC parameters? Or is this not possible on the Android? I
assume this is Java 6?
How is Java started on Android or, perhaps better question, can you
influence the GC parameters?

On Tue, Jun 15, 2010 at 02:36, Miguel Morales <therevoltingx at gmail.com>wrote:

> Hi all,
>
> For the past few months I've been developing a game using Android and
> the rabbitmq java client with fair results.
> Setting it up was fairly painless, however, I've run into one issue
> that's making one of the key parts of my game suffer.
> In Android, every time the garbage collector runs, the CPU is busy for
> a few milliseconds, ~200ms.
> This slows the frame rate and causes the game to stutter for a bit.
>
> The problem is in consuming messages, I have a thread that simply
> reads from a queue as fast as it can delivers the body bytes to the
> game client.
> However, in the library there are a bunch of small allocations that
> happen which causes the GC to run at least once every 10 seconds,
> using both a consumer and a basicGet.
>
> I've tried to look at the code and remove allocations, and have got
> the GC runs down to about 1 every 40 seconds.  Still, that GC runs and
> constant allocations
> are hindering my ability to render some decent maps on the older
> Android models (I use a G1)
>
> I also tried briefly to get the rabbitmq-c client working, and I was
> successful.
> However, I hit a roadblock when trying to send the body bytes back to
> the JVM using JNI.
> I keep running out of memory or crashing using a jbyteArray buffer.
>
> My C is pretty rusty so I was hoping someone had some suggestions
> regarding that.
> Ideally, I'd just be able to get rid of the allocations while
> consuming messages, any help is appreciated!
>
> I've created a test application for android to test out the different
> consuming implementations in github:
> http://github.com/therevoltingx/rabbitmq_android_test
>
> You can see how fiddling around with the internal java client code I
> was able to get rid of some allocations here (simply by caching
> Basic.Get):
>
> http://github.com/therevoltingx/rabbitmq_android_test/blob/master/src/com/diastrofunk/rabbitmqtest/JavaTests.java#L74
>
> You can see the C/JNI version here:
>
> http://github.com/therevoltingx/rabbitmq_android_test/blob/master/jni/ndktests.c
>
> Any help in this would be appreciated!
>
> Thanks,
> Miguel
>
> --
> http://diastrofunk.com, http://developingthedream.blogspot.com/,
> http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>



-- 
---
John Apps
(49) 171 869 1813
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100615/69259a37/attachment.htm>


More information about the rabbitmq-discuss mailing list