Commit Graph

32 Commits

Author SHA1 Message Date
Michael Bayne a4ac47fb04 Reinstated the Presents I/O refactor with the modification of ensuring
that authentication is processed on the dobjmgr thread rather than
requiring the caller to do the right thing (or not as the case happened to
be).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3433 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 21:49:19 +00:00
Ray Greenwell d58d1001ac Roll it all back.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3432 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 19:33:28 +00:00
Ray Greenwell 36af272a63 Bad idea.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3431 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 19:32:48 +00:00
Ray Greenwell f6e427a26d Bugfix?
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3430 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 19:23:26 +00:00
Michael Bayne a285695ca8 I finally broke down and did the rewrite to fix the potential race
condition between the omgr thread and the conmgr thread. Now when the omgr
thread processes an event that is going out to the clients, it flattents
the message itself for each client that is to receive the message and the
flattened data is posted to the conmgr outgoing queue.

This means that once an event is finished processing, no further
modifications to any of the data associated with the event can effect the
data queued up to be sent to the client. This is a good thing, it will
eliminate or illuminate a very baffling class of bugs that we've sort of
been ignoring because we knew this could be the cause.

We used to take an event and flatten it directly into the direct buffer
from which we would do our socket write. Now we flatten it into a
temporary byte array. This means a metric shitload more garbage generation
and collection. We used to do the flattening on the conmgr thread, now we
do it on the omgr thread. This means a big redistribution of CPU demand.

Either of those things could result in a significant negative impact on
our performance, but we'll just have to deploy this stuff and find out.
Whee! If it turns out to be a serious problem, there are potential
optimizations that could be done by keeping a pool of direct buffers
around and flattening messages into them, relying on the fact that the
outgoing conmgr queue generally doesn't grow too large and we could
allocate tens to a hundred megabytes of memory for the outgoing queue if
we really needed to.

I'd also like to test the overflow handling stuff more. It didn't really
change in that everything just deals with arrays of bytes now instead of
unflattened messages, but I'll be more comfortable once I've seen all this
in action on ice where there may be few users, but they are just as likely
to experience lag and receive an overflow queue as users on the higher
traffic servers. There is code to log when overflow queues are created and
finally flushed and how much use they got while they were around, so that
should give us an indication of whether things are operating properly.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3419 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-19 08:39:19 +00:00
Michael Bayne 45ec296ba0 Here's a giant performance improvement: the current Presents architecture
flattens messages into a buffer and then passes that bucket to a
SocketChannel.write() method which is part of the NIO business. If said
buffer is a "direct" buffer, the write() method will in theory do
high-performance shit like DMA the data right to the network card. If it's
not a direct buffer, Sun apparently makes a temporary direct buffer,
copies the data into it and passes that on to the underlying socket send()
call. We weren't using direct buffers which means that we were copying
everything one more time than needed (not a huge deal) and that we were
allocating a direct buffer for every message (a much bigger deal). This
should take a serious load off of the I/O thread and fortunately we can
test it on Ice to make sure it doesn't do anything super crazy.

All this said, this whole business is going to change when I rearchitect
Presents to avoid the potential race conditions it suffers from now and we
won't be able to use a single direct buffer to write all of our outgoing
messages, but I believe we will be able to use a pool of direct buffers
with one used by every message in the queue waiting to be written
(hopefully that won't be too many at any given time) which we can keep
around to avoid the expense of allocating and freeing direct buffers.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3336 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-02-08 05:08:47 +00:00
Michael Bayne afabea71ad Big fat Bernie javadoc cleanup.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3310 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-01-24 23:08:21 +00:00
Ray Greenwell 033e3984b6 Added a potentially dangerous temporary hack to deal with people not having compatible CreateAccountCredentials, and being told that our servers are down
when they try to create an account.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3298 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-01-06 19:28:53 +00:00
Michael Bayne c92a922678 The rabbit hole goes deeper. Now we can configure the client with a custom
classloader to use when unserializing objects off the network. Also fixed
the way custom classloaders were used as Class.forName(class, true,
loader) seems to be the proper way to go to have caching work and whatnot.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3268 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-12-10 01:23:44 +00:00
Michael Bayne 1f8c4578b7 LGPLed the library. Hello world.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3098 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-27 02:12:55 +00:00
Michael Bayne 864adbdc20 Tracked objects. Now to set about to figuring out what to track.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3075 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-13 23:44:16 +00:00
Ray Greenwell dec746b983 Use ClassUtil.getFields(clazz)
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3016 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-06-03 15:56:25 +00:00
Michael Bayne d618d3c771 Eclipse suggested cleanup.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2971 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-02-25 14:50:28 +00:00
Michael Bayne 1da661731f Added support for Date fields.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2947 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-02-03 15:02:13 +00:00
Michael Bayne 8a9c6528de Removed old debugging message.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2758 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-08-09 03:19:05 +00:00
Ray Greenwell e09ef8bbb2 If asked to find a marshaller for a pure interface, use the marshaller
for Object.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2700 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-11 01:22:16 +00:00
Michael Bayne 4c342c28f3 We need to potentially decode the length after every read. The original
code did that due to eventuall getting out of the loop, the "fixed" code
failed to do it if we failed to fill our buffer up on the first read.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2695 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-09 05:13:34 +00:00
Eric Lundberg 0ebfeadd21 Seems to be some kind of issue with moving the length == -1 check inside
the loop, so I'm rolling back to the previous version since I can't even
log in to my server with this change.  Mike if you want to take a look or
tell me what jimmyjamming needs to be done to make this change work, that
would be great.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2694 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-07 22:35:38 +00:00
Michael Bayne 17b567ba18 There was a circumstance where the framed input stream could hang if the
frame size was exactly the same size as the buffer and no future messages
came down the pipe to wake us up again. This probably would have had to
happen very early in the session as the buffer gets bigger and bigger to
accomodate the largest frame seen during the entire session and
asynchronous messages are coming in more frequently as well. Thus it's
extremely unlikely that this ever actually hung. In any case, we now log
that circumstance (and do the right thing) so we can see if the log
message turns up in future bug reports.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2693 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-06 18:39:55 +00:00
Michael Bayne ba73cc55df Deal as gracefully as possible if we don't have any data for the final
field or fields of a streamed object. This allows us to add new fields to
the end of a streamable without causing all existing serialized versions
to become unreadable.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2629 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-06-02 17:24:18 +00:00
Michael Bayne 2a554f1569 Added support for object streaming debugging.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2395 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-10 17:47:45 +00:00
Michael Bayne 4c39fb3fb8 Log our low-level stack traces when we get them because I've seen at least
one instance of the nested exception failing to log anything useful when
it is reported at a higher level and we're seeing failures in the
low-level streamable decoding code which need debugging.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2087 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-23 00:40:39 +00:00
Michael Bayne 3b86a9c669 Support implicit Object[] handling as well as Object handling.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2081 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-21 00:44:25 +00:00
Michael Bayne f04e98f481 We may be passing Object in directly in which case we have no super class.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2080 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-21 00:44:03 +00:00
Michael Bayne 00baff9000 Handle Object fields by using readObject() and writeObject() to serialize
them assuming they'll contain either a primitive type or an instance of
Streamable.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2076 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-20 23:27:52 +00:00
Michael Bayne a63d7446dd It turns out that we can make protected and private fields accessible to
the object serialization code which means that we can automatically
serialize said data members. Hooray!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2075 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-20 23:27:12 +00:00
Michael Bayne fd9a06a388 We don't need a SocketChannel. A ReadableByteChannel will suffice.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2048 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-10 19:33:22 +00:00
Michael Bayne cf578a11b5 Log the shit out of everything if we come across an invalid class code in
the object input stream.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2012 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-02 22:10:10 +00:00
Michael Bayne d6b84eb0b8 Rewritten to support I/O via channels.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1957 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-18 18:51:33 +00:00
Michael Bayne 65bc9f7eff Return number of bytes written when writing a frame.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1893 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-11-05 02:16:46 +00:00
Michael Bayne 14a313486b Documentation repairs.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1842 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-27 18:49:51 +00:00
Michael Bayne 2330afc3cd New object streaming code is born!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1605 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-07-23 05:42:34 +00:00