Re: [Spock Proxy Devel] Some spockproxy questions.
Status: Alpha
Brought to you by:
kaotao
From: Zach G. <za...@ii...> - 2008-07-29 19:25:25
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> I've got a question. I've been working on a configuration using spockproxy (which I'm really enjoying btw). So far I've got everything working pretty well, which is exciting.<br> <br> My question is, is there a way to return the incremented column value after performing an insert? Or to retrieve the value just before performing the insert? I'm working with an application that has been using an incrementing value in combination with the last_insert_id() function to track the data and continue making some changes to it.<br> <br> Anyway, I'll keep playing around. Chances are I've missed something fairly obvious.<br> <br> It's been a real pleasure using such a nicely thought out implementation like this. <br> <br> Regards!<br> <br> Zach<br> <br> On 7/21/2008 11:15 AM, Frank Flynn wrote: <blockquote cite="mid:09F...@co..." type="cite"> <div> <div> <div> <div>Karel,</div> <div> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div> <div> <div><span class="Apple-style-span" style="color: rgb(20, 79, 174);"></span></div> </div> </div> </div> </div> </span></blockquote> <br> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div> <div> <div><span class="Apple-style-span" style="color: rgb(20, 79, 174);">[Spock Proxy Devel] Some spockproxy questions.</span></div> </div> </div> </div> </div> </span></blockquote> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div> <div>From: Karel Vervaeke <a class="moz-txt-link-rfc2396E" href="mailto:karel@ou..."><karel@ou...></a> - 2008-07-18 15:24<br> </div> </div> </div> <div> <div>Hi, I just have a couple of questions<br> <br> About transactions:<br> Suppose I need to store data in two partitions in one transaction,<br> how does spockproxy the cross-server transactions?</div> </div> </div> </span></blockquote> <div><br> </div> <div>When you issue the command "BEGIN TRANSACTION" the proxy sends this command to each database shard and holds those connections for you. Then you can issues whatever commands you want and the proxy will send them to one or all the proxys (queries that do not have the sharding key in them will go to all the shards). When you issue the COMMIT or ROLL BACK the proxy sends that to each shard and releases the connections.</div> <div><br> </div> <br> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div>About the dynamic application pool:<br> The spockproxy homepage mentions: "Upon startup the proxy establishes a<br> connection pool with the minimum number of connections. After that, each<br> time a client uses a connection, it is his for the life of the<br> connection"<br> <br> For the life of the connection... does that imply that a once a<br> connection between spockproxy and the database is reserved for a client,<br> that the client can only get data from that partition?</div> </div> </div> </span></blockquote> <div><br> </div> Not at all. The proxy looks at each query and will send it to one or all of the shards depending on what it thinks is appropriate (based on your set up in the shard_range_directory and shard_table_directory tables). The idea that a connection is reserved and dedicated to a particular client is only during transactions</div> <div><br> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div>If I understand correctly, it means that the when a client connects to<br> spockproxy and it requests data from two partitions in that same<br> connection, the two connections spockproxy<->database connections<br> created will remain reserved to that client connection until the client<br> connection is closed. </div> </div> </div> </span></blockquote> <div><br> </div> No, only during a transaction.</div> <div><br> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div>Would that mean that the client should not use a<br> connection pool to spockproxy (otherwise each pooled connection will be<br> assigned server-connections for all partitions after a while?</div> </div> </div> </span></blockquote> <div><br> </div> No, connections are pooled at the proxy level. When you connect to the proxy the database connection are already established so there is not the same overhead. You can use connection pooling at the client level too with no particular problems, although since the proxy is pooling for you it might not give you the same advantages. It depends on your client I suppose.</div> <div><br> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0);"> <div style=""> <div> <div>About the choice of the 'federated' keyword.<br> That does not imply 'federated' as in the FEDERATED storage engine<br> right? (Like you would need for proper cross-server sharding with HScale<br> on mysqlproxy?)</div> </div> </div> </span></blockquote> <div><br> </div> <div>When we say 'federated' we mean it in the same sense as the federated storage engine; that is you see what looks like one database but it is in fact several databases running on different servers. But Spockproxy does not require any particular storage engine and although you could use a federated table with the proxy it's probably pointless since the proxy is federating it already. We use the INNODB storage engine primarily and have tested the MyISAM storage engine, but none of the others. There is no reason they wouldn't work but we have not tested them.</div> <div><br> </div> <div>From the HScale Documentation at: <a moz-do-not-send="true" href="http://hscale.org/display/HSCALE/Home">http://hscale.org/display/HSCALE/Home</a></div> <div><span class="Apple-style-span" style="font-size: 13px; line-height: 17px;"> "HSCALE is a plugin written for <a moz-do-not-send="true" href="http://forge.mysql.com/wiki/MySQL_Proxy" rel="nofollow" style="color: rgb(0, 51, 102);">MySQL Proxy</a> which allows you to transparently split up tables into multiple tables called <em>partitions</em>. </span></div> <div><span class="Apple-style-span" style="font-size: 13px; line-height: 17px;"> In later versions you will be able to put each partition on a different MySQL server."</span></div> <div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 17px;"><br> </span></font></div> <div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 17px;">Spockproxy splits all of your data into different databases (typically on different servers) and allows you to access these database shards as one database. So it's more like their future version; we do not do 'partitioning' as in MySQL 5.1 where within a single database a table is divided into multiple shards.</span></font></div> <div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 17px;"><br> </span></font></div> <div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px; line-height: 17px;">Finally the version in Sourceforge is a bit old - look for us to push a new version in the next day or two; no new features just fewer bugs.</span></font></div> <div><br> </div> <div>Good Luck,</div> <div>Frank</div> <br> </div> <div><br> </div> </div> </div> </div> <blockquote type="cite" class=""><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: arial; font-size: 16px;"></span></blockquote> <pre wrap=""> <hr size="4" width="90%"> ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world <a class="moz-txt-link-freetext" href="http://moblin-contest.org/redirect.php?banner_id=100&url=/">http://moblin-contest.org/redirect.php?banner_id=100&url=/</a></pre> <pre wrap=""> <hr size="4" width="90%"> _______________________________________________ spockproxy-devel mailing list <a class="moz-txt-link-abbreviated" href="mailto:spo...@li...">spo...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/spockproxy-devel">https://lists.sourceforge.net/lists/listinfo/spockproxy-devel</a> </pre> </blockquote> <br> <br> <div class="moz-signature">-- <br> <font ptsize="10" family="SANSSERIF" color="#004080" face="Verdana" lang="0" size="2">_______________________________________________________________________</font><br> <font ptsize="8" family="SANSSERIF" color="#000000" face="Arial" lang="0" size="1"><b><span style="color: rgb(0, 0, 160);">Zach Garner</span></b> <span style="color: rgb(128, 128, 192);">| </span> Sr. Systems Administrator / Product Analyst <span style="color: rgb(128, 128, 192);">|</span> iiON Corporation <span style="color: rgb(128, 128, 192);">|</span> <a style="color: rgb(0, 0, 160); text-decoration: none;" target="_blank" href="http://www.iion.com/">www.iion.com</a> <span style="color: rgb(128, 128, 192);">|</span> Office: 858-713-0450 x 20<br> <br> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br> <div style="color: rgb(0, 64, 128); text-align: justify; width: 570px;">This message (and any associated files) is intended only for the individual named and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the named addressee you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author and do not necessarily represent those of iiON Corporation.</div> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- </font></div> </body> </html> |