| 
			
		 | 
		
		
				
		
		
    
		
		
								
										
| CLR Type | 
Object/Map Property Mapping | 
Result Class/Parameter Class** | 
Type Alias** | 
 
| System.ArrayList | 
Yes | 
Yes | 
list | 
 
| System.Boolean | 
Yes | 
Yes | 
Boolean, bool | 
 
| System.Byte | 
Yes | 
Yes | 
Byte, byte | 
 
| System.Char | 
Yes | 
Yes | 
Char, char | 
 
| System.DateTime | 
Yes | 
Yes | 
dateTime, date | 
 
| System.Decimal | 
Yes | 
Yes | 
Decimal, decimal | 
 
| System.Double | 
Yes | 
Yes | 
Double, double | 
 
| System.Guid | 
Yes | 
Yes | 
guid | 
 
| System.Hashtable | 
Yes | 
Yes | 
map, hashmap, hashtable | 
 
| System.Int16 | 
Yes | 
Yes | 
Int16, short, Short | 
 
| System.Int32 | 
Yes | 
Yes | 
Int32, int, Int, integer, Integer | 
 
| System.Int64 | 
Yes | 
Yes | 
Int64, long, Long | 
 
| System.SByte | 
Yes | 
Yes | 
SByte, sbyte | 
 
| System.Single | 
Yes | 
Yes | 
Float, float, Single, single | 
 
| System.String | 
Yes | 
Yes | 
String, string | 
 
| System.TimeSpan | 
Yes | 
Yes | 
N/A | 
 
| System.UInt16 | 
Yes | 
Yes | 
Short, short | 
 
| System.UInt32 | 
Yes | 
Yes | 
Uint, uint | 
 
| System.UInt64 | 
Yes | 
Yes | 
Ulong, ulong | 
 
 
| CLR Type | 
iBatis support | 
SqlDbType | 
OleDbType | 
OdbcType | 
OracleType | 
 
| Byte[] | 
Yes | 
Binary, Image, VarBinary | 
Binary, VarBinary | 
Binary, Image, VarBinary | 
Raw | 
 
| Boolean | 
Yes | 
Bit | 
Boolean | 
Bit | 
Byte | 
 
| Byte | 
– | 
TinyInt | 
– | 
TinyInt | 
Byte | 
 
| DateTime | 
Yes | 
DateTime, SmallDateTime | 
Date | 
Date, DateTime, SmallDateTime, Time | 
DateTime | 
 
| char | 
Yes | 
Not supported | 
Char | 
Char | 
Byte | 
 
| Decimal | 
Yes | 
Decimal, Money, SmallMoney | 
Decimal, Currency, Numeric | 
Decimal, Numeric | 
Number | 
 
| Double | 
Yes | 
Float | 
Double | 
Double | 
Double | 
 
| Guid | 
Yes | 
UniqueIdentifier | 
Guid | 
UniqueIdentifier | 
Raw | 
 
| Int16 | 
Yes | 
SmallInt | 
SmallIInt | 
SmallInt | 
Int16 | 
 
| Int32 | 
Yes | 
Int | 
Integer | 
Int | 
Int32 | 
 
| Int64 | 
Yes | 
BigInt | 
BigInt | 
BigInt | 
Number | 
 
| Single | 
Yes | 
Real | 
Single | 
Real | 
Float | 
 
| String | 
Yes | 
Char, Nchar, NVarchar, Text, VarChar | 
Char, VarChar | 
Char, NChar, NText, NVarChar, Text, VarChar | 
NVarChar | 
 
| TimeSpan | 
No | 
Not supported | 
DBTime | 
Time | 
DateTime | 
 
| UInt16 | 
yes | 
Int | 
– | 
– | 
UInt16 | 
 
| UInt32 | 
yes | 
Decimal | 
– | 
– | 
UInt32 | 
 
| UInt64 | 
yes | 
Decimal | 
– | 
– | 
Number | 
 
 
 								 	
						
		
								
										먼저
- Subscription을 받아라
 
- 기술지원 업체에게 의지해라
 
- HW 의 중요성
 
mysql community < mysql enterprize 쓰레드풀이 있고 없고 차이 (12 core 이상에서 성능 차이) -> maria DB는 쓰레드풀이 존재 
- 스토리지 엔진이 따로 있다.
 
- my.cnf 를 잘 써라
 
default로 있는 것은 낮은 시스템에서 돌리게끔 되어 있는 것이다. 
- 성능 한계가 있다.
 
- BMT 수치는 맹신하지 마라
 
 
튜닝
아르노 Adant MySQL Connect 2013 발표 
http://aadant.com/blog/wp-content/uploads/2013/09/50-Tips-for-Boosting-MySQL-Performance-CON2655.pdf 
- Make sour you have enough RAM
 
- Use fast and multi-core processors
 
- Use fast and reliable storage
 
- Choose the right OS
- MySQL is excellent on Linux
 
- WIndows need 2012 R2
 
 
 
- Adjust the OS limits
- Max open files per process
 
- Max threads per user
 
 
 
- Consider using alternative malloc
- [mysqld_safe]
 
malloc-lib=/usr/lib64/libjemalloc.so.1 
- [mysqld_safe]
 
malloc-lib=tcmalloc 
 
 
- Set CPI affinity
- taskset command on linux
 
taskset -c 1-4 ‘pidof mysqld’ 
- On Windows
 
START /AFFINITY 0x1111 bin\mysqld -console 
 
 
- Choose the right file system
- xfs is excellent > ext4 > ext3
 
 
 
- Mount options
- ext4 (rw,noatime, nodiration, nobarrier, data=ordered)
 
- xfs (rw, noatime, nodiratime, nobarrier, logbufs=8, logbsize=32k)
 
- SSD specific
- trim
 
- innodb_page_size = 4k
 
- innodb_flush_neighbors = 0
 
 
 
 
 
- Choose the best I/O scheduler (Use deadline or noop on Linux)
- deadline is generally the best I/O scheduler
 
echo deadline > /sys/block/{DEVICE-NAME}/queue/scheduler 
- the best value is HW and WL specific
 
noop on high end controller 
 
 
- Use a battery backed disk cache
 
- Balance the load on several disks (SSD)
 
- Turn Off the Query Cache
- query_cache_type = 0
 
- query_cache_size = 0
 
- qcache_free_blocks > 5-10k
 
 
 
- Use the Thread Pool
 
- Configure table caching
- table_open_cache
- not too small, not too big, used to size PS
 
- opened_tables / sec
 
 
 
- table_definition_cache
- do not forget to increase
 
- opened_table_definitions / sec
 
 
 
- table_cache_instances = 8 or 16
 
- innodb_open_files
 
- mdl_hash_instances = 256
 
 
 
- Cache the threads
 
- Reduce per thread memory usage
- Memory allocation is expensive = max_used_connections *(
 
read_buffer_size + 
read_rnd_buffer_size + 
join_buffer_size + 
sort_buffer_size + 
binlog_cache_size + 
thread_stack + 
2 * net_buffer_length… 
) 
 
 
- Beware of sync_binlog = 1
 
- Move your tables to InnoDB
 
- Use a large buffer pool (80% buffer pool)
- innodb_buffer_pool_size
 
- Do not swap !
 
 
 
- Reduce the buffer pool contention
 
- Use large redo logs
- 버전 5.6 이상에서는 2기가 이상 사용이 가능하다
 
 
 
- Adjust the IO capacity
- 5200 RPM 에서 만들어진 기능으로 그다지…
 
- 디폴트 값이 너무 낮긴 하지만 성능 향상에 그렇게까지큰 도움이 되지는 않는다.
 
 
 
- Configure the InnoDB flushing
- 커밋할때 로그를 플러쉬 어떻게 할것인가?
 
- 안정성을 중요시하면 1
 
- 엔간하면 2로 놔도…
 
- innodb_flush_method = O_DIRECT // 커널 복사 비용 없이 DMA를 사용 가끔 linux 커널 버전이 이상해서 파일 시스템에서 Direct IO가 켜져있지 않은 경우 골때릴수는 있다. 윈도우는 옵션이 다르다
 
 
 
- Enable innodb_file_per_table
 
- Configure the thread concurrency
 
- Reduce the transaction isolation
 
- Design the tables
- latin1 -> utf-8
 
- primary key -> int
 
 
 
- Add indexes
- innodb 는 data와 index가 같은 파일 안에 들어가서 무조건 많이 잡는게 꼭 좋아지지는 않는다.
 
 
 
- Remove unused indexes
 
- Reduce rows_examined
- 쿼리 쓸때 자료 확인하는 데이터 수를 줄이는 것은 당연
 
 
 
- Reduce rows_sent
- 쿼리 쓸때 select 해서 가져오는 자료 갯수 줄이는 것도 당연
 
 
 
- Reduce locking
- lock을 줄이는 것도 당연
 
- 특히 mysql은 auto commit 이 디폴트인데 이걸 쓰지 않도록…
 
 
 
- Mine the slow query log
 
- Use the performance_schema
- 퍼포먼스 툴을 잘 사용해야 한다
 
- 퍼포먼스 툴을 사용하는 시점에 10% 의 성능 하향이 일어난다.
 
- 버전 8정도부터는 그렇게 성능의 하향이 일어나지는 않는다
 
 
 
- Tune the replication thread
- 알려진 버그가 좀 있어서…
 
- 만약 사용하려면 binlog_format=ROW 옵션이 필요하다
 
 
 
- Avoid temporary tables on disk
- mysql은 join을 하거나 할때 용량이 크면 temp table을 다 disk에다 쓴다.
 
- temp table을 ram에 올려야 한다.
 
- temp file system을 사용하더라도 너무 크게 잡으로 swap을 사용하기 때문에
 
 
 
- Cache data in the App
 
- Avoid long running transactions
 
- Close idle connections
- 가능하면 클라이언트에서 timeout을 사용해서 어느정도 시간이 지나면 저절로 끊어지게 해라
 
 
 
- Close prepare statements
 
- Configure Connector / J
- JDBC Connector 인데 굳이 JDBC를 사용할일은 없으니까
 
- mysql connector 와 maria connector등을 같이 쓰지 말고 제발 제대로 된 프로그램을 써라
 
 
 
- Do not use the information_schema in your App
 
- View are not good for performance
 
- Sacle out, shard
 
- Monitor the database and OS
 
- Backup the database
 
- Optimize table and data files
- 주기적으로 해야 하는 게 맞다
 
- 라이브서버에서는 하지 마라
 
 
 
- Upgrade regularly
 
- Perform regular health checks
 
 
 								 	
						
		
								
										강조 표시된 부분만 변경하여도 광고는 제거되지만 모두 변경할 것을 권장한다. 해당 값을 모두 ‘false’로 변경한다. 
		
		
			
			
			
			
				
					
				| 
					
				 | 
						bt.enable_pulse distributed_share.enable offers.content_offer_autoexec offers.featured_content_badge_enabled offers.featured_content_notifications_enabled offers.featured_content_rss_enabled offers.sponsored_torrent_offer_enabled 상단 광고를 제거한다. offers.left_rail_offer_enabled 좌측 광고 제거를 제거한다. gui.show_plus_upsell 좌측 광고를 제거하면 나타나는 PRO 광고를 제거한다. gui.show_notorrents_node 토렌트가 없을 때 목록에 뜨는 PRO 광고를 제거한다.  | 
					 
				 
			 
		 
숨겨진 설정 
Shift + F2 단축키를 누른 상태에서 ‘옵션’ – ‘설정’ – ‘고급 설정’을 클릭한다. 마찬가지로 해당 값을 모두 ‘false’로 변경한다. 
		
		
			
			
			
			
				
					
				| 
					
				 | 
						gui.show_gate_notify gui.show_plus_av_upsell gui.show_plus_conv_upsell gui.show_plus_upsell_nodes ‘Upgrade to Pro’ 항목을 제거한다. (버전에 따라 재시작 후 사라지지 않는 현상이 있다.)  | 
					 
				 
			 
		 
 								 	
						
	
					
    
 | 
	 
 
 링크
 |