<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 1, 2013 at 12:40 PM, Radim Vansa <span dir="ltr"><<a href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">|<br>
| Radim, do these problems happen with the HotRod server, or only with<br>
| memcached?<br>
<br>
</div>I didn't test memcached, only HotRod. The thing I was seing were many OOB threads stuck when sending messages from handleRemoteWrite.<br>
<div class="im"><br>
|<br>
| HotRod requests handled by non-owners should be very rare, instead<br>
| the vast majority should be handled by the primary owner directly.<br>
| So if this happens with HotRod, we should focus on fixing the HotRod<br>
| routing instead of focusing on how to handle a large number of<br>
| requests from non-owners.<br>
|<br>
|<br>
|<br>
| That being said, even if a HotRod put request is handled by the<br>
| primary owner, it "generates" (numOwners - 1) extra OOB requests. So<br>
| if you have 160 HotRod worker threads per node, you can expect 4 *<br>
| 160 OOB messages per node. Multiply that by 2, because responses are<br>
| OOB as well, and you can get 1280 OOB messages before you even start<br>
| reusing any HotRod worker thread. Have you tried decreasing the<br>
| number of HotRod workers?<br>
<br>
</div>Decreasing the number of workers would be obvious solution how to scale it down. To be honest, I haven't tried that because it would certainly lower the overall throughput, and it is not a systematic solution IMO.<br>
<div class="im"><br></div></blockquote><div><br></div><div>You never know, a lower number of worker threads may mean lower contention, fewer context switches, so I think it's worth experimenting.<br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
|<br>
| The thing is, our OOB thread pool can't use queueing because we'd get<br>
| a queue full of commit commands while all the OOB threads are<br>
| waiting on keys that those commit commands would unlock. As the OOB<br>
| thread pool is full, we discard messages, which I suspect slows<br>
| things down quite a bit (especially if it's a credit<br>
| request/response message). So it may well be that a lower number of<br>
| HotRod working threads would perform better.<br>
<br>
</div>We have already had similar talk where you convinced me that having queue for the thread pool wouldn't help much.<br>
<div class="im"><br></div></blockquote><div><br></div><div>Having a queue for the OOB thread pool definitely won't help for transactional caches, as you'll get deadlocks between prepare commands waiting for cache keys and commit commands waiting in the OOB queue. I'm guessing with the primary owners in non-transactional caches now forwarding commands to the backup owners you can get deadlocks there as well if you enable queueing. So yeah, enabling queueing still isn't an option...<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
|<br>
| On the other hand, why is increasing the number of OOB threads a<br>
| solution? With -Xss 512k, you can get 2000 threads with only 1 GB of<br>
| virtual memory (the actual used memory is probably even less, unless<br>
| you're using huge pages). AFAIK the Linux kernel doesn't break a<br>
| sweat with 100000 threads running, so having 2000 threads just<br>
| hanging around, waiting for a response, should be such a problem.<br>
|<br>
</div>I don't say that it won't work (you're right that it's just virtual memory), but I have thought that Infinispan should scale and be robust even for the edge cases.<br>
<div class="im"><br></div></blockquote><div><br></div><div>Define edge cases :)<br></div><div><br></div><div>The users usually require a certain number of simultaneous clients, a certain throughput, etc. I don't think anyone will say "Yeah, we'll use Infinispan, but only if it uses less than 1000 threads".<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
|<br>
| I did chat with Bela (or was it a break-out session?) about moving<br>
| Infinispan's request processing to another thread pool during the<br>
| team meeting in Palma. That would leave the OOB thread pool free to<br>
| receive response messages, FD heartbeats, credit requests/responses<br>
| etc. The downside, I guess, is that each request would have to be<br>
| passed to another thread, and the context switch may slow things<br>
| down a bit. But since the new thread pool would be in Infinispan, we<br>
| could even do tricks like executing a commit/rollback directly on<br>
| the OOB thread.<br>
<br>
</div>Hmm, for some messages (nonblocking) the context switch could be spared. It depends how complicated is to determine whether the message will block before entering the interceptor chain.<br>
<div class="im"><br></div></blockquote><div><br></div><div>You don't have to be very specific, optimizing for ClusteredGet/Commit/Rollback commands should be enough.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
|<br>
|<br>
| In the end, I just didn't feel that working on this was justified,<br>
| considering the number of critical bugs we had. But maybe now's the<br>
| time to start experimenting...<br>
|<br>
<br>
</div>I agree and I'm happy that ISPN is mostly working now.<br>
<br>
I have tried to rerun the scenario with upper OOB limit 2000 and it did not help (originaly I was using 200 and increased to 1000), node stops responding in one moment... So maybe OOB is not the only villain. I'll keep investigating.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>I'm wondering if you could collect some statistics about the JGroups thread pools, how many threads are busy at each point during the test. How many HotRod workers are busy in the entire cluster when the OOB thread pool gets full should be interesting as well...<br>
<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
Radim<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
|<br>
|<br>
|<br>
|<br>
|<br>
| On Fri, Feb 1, 2013 at 10:04 AM, Radim Vansa < <a href="mailto:rvansa@redhat.com">rvansa@redhat.com</a> ><br>
| wrote:<br>
|<br>
|<br>
| Hi guys,<br>
|<br>
| after dealing with the large cluster for a while I find the way how<br>
| we use OOB threads in synchronous configuration non-robust.<br>
| Imagine a situation where node which is not an owner of the key calls<br>
| PUT. Then the a RPC is called to the primary owner of that key,<br>
| which reroutes the request to all other owners and after these<br>
| reply, it replies back.<br>
| There are two problems:<br>
| 1) If we do simultanously X requests from non-owners to the primary<br>
| owner where X is OOB TP size, all the OOB threads are waiting for<br>
| the responses and there is no thread to process the OOB response and<br>
| release the thread.<br>
| 2) Node A is primary owner of keyA, non-primary owner of keyB and B<br>
| is primary of keyB and non-primary of keyA. We got many requests for<br>
| both keyA and keyB from other nodes, therefore, all OOB threads from<br>
| both nodes call RPC to the non-primary owner but there's noone who<br>
| could process the request.<br>
|<br>
| While we wait for the requests to timeout, the nodes with depleted<br>
| OOB threadpools start suspecting all other nodes because they can't<br>
| receive heartbeats etc...<br>
|<br>
| You can say "increase your OOB tp size", but that's not always an<br>
| option, I have currently set it to 1000 threads and it's not enough.<br>
| In the end, I will be always limited by RAM and something tells me<br>
| that even nodes with few gigs of RAM should be able to form a huge<br>
| cluster. We use 160 hotrod worker threads in JDG, that means that<br>
| 160 * clusterSize = 10240 (64 nodes in my cluster) parallel requests<br>
| can be executed, and if 10% targets the same node with 1000 OOB<br>
| threads, it stucks. It's about scaling and robustness.<br>
|<br>
| Not that I'd have any good solution, but I'd really like to start a<br>
| discussion.<br>
| Thinking about it a bit, the problem is that blocking call (calling<br>
| RPC on primary owner from message handler) can block non-blocking<br>
| calls (such as RPC response or command that never sends any more<br>
| messages). Therefore, having a flag on message "this won't send<br>
| another message" could let the message be executed in different<br>
| threadpool, which will be never deadlocked. In fact, the pools could<br>
| share the threads but the non-blocking would have always a few<br>
| threads spare.<br>
| It's a bad solution as maintaining which message could block in the<br>
| other node is really, really hard (we can be sure only in case of<br>
| RPC responses), especially when some locks come. I will welcome<br>
| anything better.<br>
|<br>
| Radim<br>
|<br>
|<br>
| -----------------------------------------------------------<br>
| Radim Vansa<br>
| Quality Assurance Engineer<br>
| JBoss Datagrid<br>
| tel. +420532294559 ext. 62559<br>
|<br>
| Red Hat Czech, s.r.o.<br>
| Brno, Purkyňova 99/71, PSČ 612 45<br>
| Czech Republic<br>
|<br>
|<br>
| _______________________________________________<br>
| infinispan-dev mailing list<br>
| <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
| <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
|<br>
| _______________________________________________<br>
| infinispan-dev mailing list<br>
| <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
| <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></div></div></blockquote></div><br></div></div>