Home Database Mysql Tutorial 关于Amoeba读取longblob字段的问题_MySQL

关于Amoeba读取longblob字段的问题_MySQL

Jun 01, 2016 pm 01:46 PM
aisle

bitsCN.com

最近有一个应用使用Amoeba从几个库中读取MySQL中含有longblob字段的表,老是报Session was killed。

经查是Amoeba中可读通道的缓存大小引起的。原来在com.meidusa.amoeba.net.io.PacketInputStream类中,有一个属性maxPacketSize,限制了可读通道的缓存大小,如果当前读取的记录的长度大于maxPacketSize,就会报错。所以我们必须把它调大点。

Java代码 
/** 最大容量 */ 
protected static final int MAX_BUFFER_CAPACITY = 1024 * 1024 * 2; 
private int maxPacketSize = MAX_BUFFER_CAPACITY; 
 
 
public int getMaxPacketSize() { 
    return maxPacketSize; 

 
public void setMaxPacketSize(int maxPacketSize) { 
    this.maxPacketSize = maxPacketSize; 

maxPacketSize默认是2MB,但是发现setMaxPacketSize方法没有在其它地方有调用,应该是不可配置的,因此我直接修改了MAX_BUFFER_CAPACITY,重新打包扔上去就没问题了。


另外,当maxPacketSize大小不足时,用SQLYog连代理时的时候,发现一个有趣的现象。假如我有一表,各字段长度如下:
field1 | field2
1M     | 3M

如果我先执行:SELECT field2 FROM tab
这时出错:Lost connection to MySQL server during query
再执行:SELECT field1 FROM tab
SQLYog就没有响应了,然后amoeba抛OOM异常,屡试不爽。查DUMP文件后,发现AuthingableConnectionManager 和 Log4j的DailyRollingFileAppender塞满了内存。

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is chan channel in Go language What is chan channel in Go language Jan 10, 2023 pm 06:55 PM

In the Go language, a channel (chan) is a communication pipe between goroutines and a medium for goroutine to communicate with another goroutine. Channels are a technology that allows one goroutine to send data to another goroutine; by default, channels are bidirectional, meaning a goroutine can send or receive data through the same channel.

golang function channel passed as parameter golang function channel passed as parameter Apr 22, 2024 pm 06:36 PM

In Go, we can easily share and pass data between functions by passing function channels as function arguments using the chan keyword. The specific steps are as follows: Create a channel to pass a specific type of data. Pass the channel as a parameter in the function using the chan keyword and the channel name. Use one-way channels

Go function performance optimization: tips on using pipes and channels Go function performance optimization: tips on using pipes and channels May 03, 2024 am 09:33 AM

Pipes and channels are important tools for achieving parallelism and concurrency in Go. They can optimize Go function performance in the following ways: Pipeline: implement parallel I/O and improve throughput. Channels: Buffered pipelines that manage concurrent execution of computationally intensive tasks. Selective reception: Receive data from multiple channels to improve efficiency.

Types and rules of channels in concurrent programming of Golang functions Types and rules of channels in concurrent programming of Golang functions Apr 18, 2024 am 08:57 AM

Channels are a communication mechanism in the Go language for safely transferring data between concurrent functions. They provide data race protection to avoid direct access to shared memory. Channel types include unbuffered channel (chanT) and buffered channel (chanT, int). The rules include sending the value (

Implement Select Channels Go concurrent programming efficiency improvement through golang Implement Select Channels Go concurrent programming efficiency improvement through golang Sep 27, 2023 pm 02:58 PM

Implementing SelectChannelsGo concurrent programming efficiency improvement through Golang Introduction: In today's software development field, efficient concurrent programming is crucial. Concurrent programming can maximize the use of the multi-core capabilities of modern processors and improve program execution efficiency and performance. Golang is a programming language designed with concurrency in mind. Through its built-in goroutine and channel mechanisms, efficient concurrent programming can be easily achieved. This article will use Golang to

How to close the channel in golang How to close the channel in golang Jan 11, 2023 am 11:12 AM

In golang, you can use the close() function to close the channel, the syntax is "close(msg_chan)". The channel (chan) is a system resource, so when you do not need to use chan, you need to use the built-in function close to manually close the pipe. Note: If you send data to a closed pipe, the program will panic.

The relationship between golang function concurrency control and channels The relationship between golang function concurrency control and channels Apr 25, 2024 am 08:39 AM

In the Go language: Function concurrency control allows the creation of concurrently executed functions using the keyword go or goroutine. A channel is a buffer queue used to pass values ​​between concurrent functions, providing synchronization and communication. be usable

How are channels in golang functions implemented? How are channels in golang functions implemented? Jun 03, 2024 am 10:45 AM

In the Go language, the internal structure of a channel includes element types, buffer pointers, mutex locks, and send and receive queues. The sending and receiving mechanism involves waking up goroutine to send or receive data. Channels are divided into buffered and unbuffered. Buffered channels allow a goroutine to send data without a receiver, while unbuffered channels require a receiver before sending.

See all articles