<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx</link><description>Do you currently use selectMethod=cursor to work around OOM errors with very large result sets? Do you find that the driver seems to consume quite a lot of memory for forward only read only result sets? Does it seem like it takes a long time to return</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>SQL SERVER JDBC DRIVER 1.2 CTP &amp;laquo; BEN GE??ERKEN&amp;#8230; [A Blog by ??brahim DEM??R ]</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#5137046</link><pubDate>Wed, 26 Sep 2007 09:27:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5137046</guid><dc:creator>SQL SERVER JDBC DRIVER 1.2 CTP « BEN GE??ERKEN… [A Blog by ??brahim DEM??R ]</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://ibrahimdemir.wordpress.com/2007/09/26/sql-server-jdbc-driver-12-ctp/"&gt;http://ibrahimdemir.wordpress.com/2007/09/26/sql-server-jdbc-driver-12-ctp/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#7232724</link><pubDate>Fri, 25 Jan 2008 06:42:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7232724</guid><dc:creator>David</dc:creator><description>&lt;p&gt;My experience using this new setting do not seem to square with its description. I altered my connection to use selectMethod=direct and responseBufering=adaptive. When I executed my query and watched my console output and Task Manager network activity I saw my &amp;quot;exec query&amp;quot; println, then several minutes of sustained incoming data, then ...processing N records...&amp;quot; as my loop read the data. While the loop was running there was no network activity. I would have expected to see network activity concurrent with moving through the result set. What am I missing?&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#7242969</link><pubDate>Fri, 25 Jan 2008 20:21:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7242969</guid><dc:creator>David Olix, SQL Server</dc:creator><description>&lt;p&gt;Do you have a typo in your connection string? &amp;nbsp;The responseBuffering connection property is spelled with two 'f's.&lt;/p&gt;
&lt;p&gt;David Olix, SQL Server&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8129699</link><pubDate>Mon, 10 Mar 2008 13:10:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8129699</guid><dc:creator>asta</dc:creator><description>&lt;p&gt;Does responseBuffering option work also when connecting to SQL Server 2000?&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8466926</link><pubDate>Wed, 07 May 2008 23:13:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8466926</guid><dc:creator>Sandra</dc:creator><description>&lt;p&gt;it works perfectly for me. I could get a 400000 records query without any Out of Memory errors. THANK YOU.&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8473208</link><pubDate>Thu, 08 May 2008 20:49:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8473208</guid><dc:creator>haibing qiao</dc:creator><description>&lt;p&gt;if I have a image column called &amp;quot;image_col&amp;quot;, and the execute:&lt;/p&gt;
&lt;p&gt;1: ResultSet rs = Statement.execute (&amp;quot;select image_col from table_&amp;quot;;&lt;/p&gt;
&lt;p&gt;2: InputStream in = rs.getBinaryStream(&amp;quot;image_col&amp;quot;);&lt;/p&gt;
&lt;p&gt;the problem is that after (1), it already allocating memory with the size of the image_col, if (1) returns 1 row, and there is 100M, then it will allocate 100M memory in the Java process already. &lt;/p&gt;
&lt;p&gt;is this something expected?&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8473432</link><pubDate>Thu, 08 May 2008 21:20:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8473432</guid><dc:creator>David Olix, SQL Server</dc:creator><description>&lt;p&gt;A simple select of a single large column in a forward only read only result set should work fine with adaptive buffering.&lt;/p&gt;
&lt;p&gt;Is selectMethod=cursor set as a connection property? &amp;nbsp;That property inhibits adaptive response buffering. &amp;nbsp;If you were using selectMethod=cursor to avoid OOM errors before v1.2, that property should be removed to use adaptive response buffering instead.&lt;/p&gt;
&lt;p&gt;Is the ResultSet scrollable or updatable? &amp;nbsp;If so, you'll need to crank down the fetch size to 1 and set adaptive response buffering directly on the Statement object (cast it to SQLServerStatement to get to the setResponseBuffering method) before executing.&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8473933</link><pubDate>Thu, 08 May 2008 22:34:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8473933</guid><dc:creator>haibing qiao</dc:creator><description>&lt;p&gt;Thanks foir the quick reply.&lt;/p&gt;
&lt;p&gt;here is the code snippet for how I create a DB connection and how to do a query, but if I select a 100M blob, I still see 100M drop of free memory (you need to start JVM with -ms500m -mx500m), &lt;/p&gt;
&lt;p&gt;I will appreciate if you could suggest if I should do it differently, and if not if you can spend sometime to reproduce it,&lt;/p&gt;
&lt;p&gt;		Class.forName(&amp;quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&amp;quot;);&lt;/p&gt;
&lt;p&gt;		Connection conn = DriverManager&lt;/p&gt;
&lt;p&gt;		.getConnection(&amp;quot;jdbc:sqlserver://&amp;quot; + dbServer+&amp;quot;;user=&amp;quot;+user +&lt;/p&gt;
&lt;p&gt;				&amp;quot;;password=&amp;quot;+password +&amp;quot;;databaseName=&amp;quot;+ dbName +&amp;quot;;responseBuffering=adaptive&amp;quot;);&lt;/p&gt;
&lt;p&gt;		System.gc();&lt;/p&gt;
&lt;p&gt;		long &amp;nbsp;m1 = Runtime.getRuntime().freeMemory();&lt;/p&gt;
&lt;p&gt;		System.out.println(&amp;quot; the memory before is &amp;nbsp;:&amp;quot; + &amp;nbsp;m1));&lt;/p&gt;
&lt;p&gt;		PreparedStatement ps2 = conn.prepareStatement(&amp;quot; select c2 from dbo.table1 where c1=?&amp;quot;, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);&lt;/p&gt;
&lt;p&gt;		ps2.setFetchSize(1);&lt;/p&gt;
&lt;p&gt;		((SQLServerStatement ) ps2).setResponseBuffering(&amp;quot;adaptive&amp;quot;);&lt;/p&gt;
&lt;p&gt;		ps2.setInt(1, number);&lt;/p&gt;
&lt;p&gt;		ResultSet rs = ps2.executeQuery();&lt;/p&gt;
&lt;p&gt;		ps.close(); // cause server call of &amp;quot;unprepare&amp;quot;&lt;/p&gt;
&lt;p&gt;		System.gc();&lt;/p&gt;
&lt;p&gt;		long &amp;nbsp;m2 = Runtime.getRuntime().freeMemory();&lt;/p&gt;
&lt;p&gt;		System.out.println(&amp;quot; the memory after select is &amp;nbsp;:&amp;quot; + &amp;nbsp;(m2) &amp;nbsp;);&lt;/p&gt;
&lt;p&gt;		InputStream inc = null;&lt;/p&gt;
&lt;p&gt;		if( rs.next() ) {&lt;/p&gt;
&lt;p&gt;			inc = rs.getBinaryStream(&amp;quot;c2&amp;quot;);&lt;/p&gt;
&lt;p&gt;();&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8555499</link><pubDate>Wed, 28 May 2008 00:27:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8555499</guid><dc:creator>mpeebles</dc:creator><description>&lt;p&gt;I am finding that the adaptive buffering returns rows at the same rate as the server side cursor. &amp;nbsp;It may improve memory on large resultsets but I cannot seem to get performance up to the level of a similar app written in .NET using SqlDataReaders. &amp;nbsp;The JDBC performance is really bad.&lt;/p&gt;
&lt;p&gt;My app creates 6 threads, each with their own connection to the same SQL Server instance query different tables with the same replicated data. &amp;nbsp;The resultset will return 83,000 rows of 17 columns of data (a good mix of data types...no blobs). &amp;nbsp;The app will loop through every row and column but do nothing with the data, except reading it.&lt;/p&gt;
&lt;p&gt;JDBC averages 79 seconds&lt;/p&gt;
&lt;p&gt;.NET averages 0.90 seconds&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;p&gt;Here is a snippet of the java thread code:&lt;/p&gt;
&lt;p&gt;Connection c = DriverManager.getConnection(&amp;quot;jdbc:sqlserver://&amp;quot; + host + &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;:1433;databaseName=&amp;quot; + database + &amp;quot;;user=&amp;quot; + user + &amp;quot;;password=&amp;quot; + password + &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;;responseBuffering=adaptive;&amp;quot;);&lt;/p&gt;
&lt;p&gt;long start = System.currentTimeMillis();&lt;/p&gt;
&lt;p&gt;Date startDate = new Date(start);&lt;/p&gt;
&lt;p&gt;//	 &amp;nbsp;Statement stmt = c.createStatement();&lt;/p&gt;
&lt;p&gt;Statement stmt = c.createStatement(SQLServerResultSet.TYPE_SS_SERVER_CURSOR_FORWARD_ONLY,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SQLServerResultSet.CONCUR_READ_ONLY);&lt;/p&gt;
&lt;p&gt;((SQLServerStatement) stmt).setResponseBuffering(&amp;quot;adaptive&amp;quot;);&lt;/p&gt;
&lt;p&gt;ResultSet rs = stmt.executeQuery(sql);&lt;/p&gt;
&lt;p&gt;rs.setFetchSize(10000);&lt;/p&gt;
&lt;p&gt;ResultSetMetaData rsMetaData = rs.getMetaData();&lt;/p&gt;
&lt;p&gt;int numberOfColumns = rsMetaData.getColumnCount();&lt;/p&gt;
&lt;p&gt;String tempVar;&lt;/p&gt;
&lt;p&gt;int rowCounter = 0;&lt;/p&gt;
&lt;p&gt;// loop through rows in resultset&lt;/p&gt;
&lt;p&gt;while (rs.next()) {&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;// loop all columns and read value&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;for (int i=1; i&amp;lt;numberOfColumns; i++) {&lt;/p&gt;
&lt;p&gt;		 &amp;nbsp;tempVar = rs.getString(i);&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp;rowCounter += 1;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Is the JDBC code that much different at the TDS protocol than .NET?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8896678</link><pubDate>Tue, 26 Aug 2008 11:28:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8896678</guid><dc:creator>knuterikt</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I have a scenario where I send several queries to sql server simultaniously (processed in different threads). OOM problem dissapears when I execuite only one query but resurface when more are beeing executed in paralell. &lt;/p&gt;
&lt;p&gt;Questions:&lt;/p&gt;
&lt;p&gt;what is the size of the client side buffer?&lt;/p&gt;
&lt;p&gt;Can we control the size of the client side buffer?&lt;/p&gt;
&lt;p&gt;TIA&lt;/p&gt;
&lt;p&gt;Knut&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8897691</link><pubDate>Tue, 26 Aug 2008 18:48:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8897691</guid><dc:creator>Mugunthan Mugundan - MSFT</dc:creator><description>&lt;p&gt;Are you using adaptive buffering or full buffering? With full buffering there is no limit to the client cache and you cannot control the size of the cache. &lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8899670</link><pubDate>Wed, 27 Aug 2008 14:59:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8899670</guid><dc:creator>knuterikt</dc:creator><description>&lt;p&gt;I'm using adaptive response buffering, my scenario is like this. &lt;/p&gt;
&lt;p&gt;I have a component that reads a large resultset.&lt;/p&gt;
&lt;p&gt;First test: read data without adaptive response buffering -&amp;gt; OOM error&lt;/p&gt;
&lt;p&gt;Second test: Turn on adaptive response buffering (using parameters on url) -&amp;gt; No OOM error&lt;/p&gt;
&lt;p&gt;Third test: Start several reader threads in parallel with adaptive response buffering enabled (as in prev test) -&amp;gt; OOM error&lt;/p&gt;
&lt;p&gt;My question(s):&lt;/p&gt;
&lt;p&gt;&amp;quot;adaptive response buffering&amp;quot; indicates to me that the driver use some memory for buffering, how is the size of this buffer determined?&lt;/p&gt;
&lt;p&gt;Can/Will the size of the client side buffer be adjusted during execution?&lt;/p&gt;
&lt;p&gt;Can I set the maximum memory used for buffering?&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8900373</link><pubDate>Wed, 27 Aug 2008 18:12:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8900373</guid><dc:creator>Mugunthan Mugundan - MSFT</dc:creator><description>&lt;p&gt;Adaptive buffering implies it buffers it absolutely has to. The size of the buffer is not limited or controlled in anyway. &lt;/p&gt;
&lt;p&gt;The problem is that when you have several readers working off a single connection, we are forced to buffer the reply from the previous requests to get the data for the current request. &lt;/p&gt;
&lt;p&gt;There are few ways of solving this.&lt;/p&gt;
&lt;p&gt;1) Using server cursors.&lt;/p&gt;
&lt;p&gt;2) Using multiple connections instead of a single connection. However you may not want to create too many connections.&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8901897</link><pubDate>Thu, 28 Aug 2008 02:30:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8901897</guid><dc:creator>knuterikt</dc:creator><description>&lt;p&gt;Hi thanks for your answer.&lt;/p&gt;
&lt;p&gt;Just to be clear, I have one connection and one statement per thread. But all these connections will compete over the same available memory. So if SQL server can deliver rows faster than I can process them I will se the OOM error at some point?&lt;/p&gt;
&lt;p&gt;So how is memory size used for buffering contolled in this scenario? What's the adaptiv part?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Knut&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8901993</link><pubDate>Thu, 28 Aug 2008 03:07:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8901993</guid><dc:creator>Mugunthan Mugundan - MSFT</dc:creator><description>&lt;p&gt;If you are using one statement per connection then the driver will not load all the data SQLServer is sending. IE the driver will block and wait for you to consume the data before reading more data from the server. The adaptive part will kick in only when if you are trying to execute another command from the same connection.&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#8903410</link><pubDate>Thu, 28 Aug 2008 17:11:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8903410</guid><dc:creator>knuterikt</dc:creator><description>&lt;p&gt;Ok but still the driver allocates memory to hold some rows from the result set? Do you know how much memory it will consume?&lt;/p&gt;
</description></item><item><title>re: What is adaptive response buffering and why should I use it?</title><link>http://blogs.msdn.com/jdbcteam/archive/2007/05/02/what-is-adaptive-response-buffering-and-why-should-i-use-it.aspx#9007955</link><pubDate>Mon, 20 Oct 2008 22:00:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9007955</guid><dc:creator>Anupam</dc:creator><description>&lt;p&gt;Does responseBuffering option works when connecting to SQL Server 2000?&lt;/p&gt;
</description></item></channel></rss>