´ë¹®    
FindPage  |  TitleIndex  |  UserPreferences  |  [http]me2day  |  redpixel
RecentChanges
 


OTL


Contents

1 ¸µÅ©
2 ¸®´ª½º¿¡¼­ mysql°ú °°ÀÌ »ç¿ëÇÒ ¶§
3 ¸Þ´º¾ó ¹ø¿ª
3.1 ½ºÆ®¸² Ç®¸µ

1 ¸µÅ© #

  • ÁÂÀý ¾Æ´Õ´Ï´Ù. :(
  • ¸ÞÀÎ ¸µÅ© : [http]http://otl.sourceforge.net
  • oracle ¹× ODBC °ü·Ã ¿¬°áÀ» C++»ó¿¡¼­ ¼Õ½±°Ô ±¸ÇöÇØÁÖ´Â ¶óÀ̺귯¸®. ÅÛÇø´À¸·Î Á¦À۵ǾîÀÖ°í ´ÜÁö Çì´õÈ­ÀÏ Çϳª¶ó´Â °ÍÀÌ Æ¯ÀÌÇÏ´Ù. ±×·¯¹Ç·Î C++À» Áö¿øÇÏ´Â °ÅÀÇ ¸ðµç Ç÷¿Æû¿¡¼­ »ç¿ë°¡´ÉÇÏ´Ù´Â °ÍÀÌ ÀåÁ¡.

2 ¸®´ª½º¿¡¼­ mysql°ú °°ÀÌ »ç¿ëÇÒ ¶§ #

  • unixodbc´Â 2.2.9-1 rpmÀ» ¼³Ä¡ÇÏ´Â °ÍÀÌ ÁÁ´Ù. ¹°·Ð develµµ °°ÀÌ ¼³Ä¡ÇÑ´Ù.
  • MyODBCµµ ¿ª½Ã ÃֽůÇÀ» ¼³Ä¡ÇÑ´Ù.
  • ÄÄÆÄÀϽà ´ÙÀ½°ú °°ÀÌ #defineÀÌ µÇ¾îÀÖ¾î¾ßÇÑ´Ù.
    #define OTL_ODBC
    #define OTL_ODBC_UNIX
    

3 ¸Þ´º¾ó ¹ø¿ª #

3.1 ½ºÆ®¸² Ç®¸µ #

OTL ½ºÆ®¸² Ç®¸µÀº ºñÈ¿À²ÀûÀ¸·Î °ü¸®µÇ´Â otl_stream °´Ã¼µéÀ» ¼º´ÉÀ» °í·ÁÇÏ´Â Çѵµ³»¿¡¼­ º¸´Ù ´õ ³ªÀº ¹«¾ð°¡·Î º¯È¯Çϵµ·Ï ÇϱâÀ§ÇÑ »õ·Î¿î ü°èÀÔ´Ï´Ù. otl_stream ÀνºÅϽºµéÀº ´ÝÈ÷°Ô µÉ¶§ Â÷ÈÄ Àç»ç¿ëÀ» À§ÇØ stream Ç® ³»¿¡ ÀúÀåµË´Ï´Ù. ÀϹÝÀûÀ¸·Î ÇÁ·Î±×·¥»ó¿¡¼­´Â ÇÔ¼ö¾È¿¡ Áö¿ªÀûÀ¸·Î otl_stream º¯¼ö¸¦ ¼±¾ðÇÏ´Â °ÍÀÌ ´õ »ç¿ëÇÏ±â Æí¸®ÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ·² °æ¿ì ÇÔ¼ö°¡ ¹Ýº¹ÀûÀ¸·Î È£ÃâµÉ ¶§ ¸¶´Ù ½ºÆ®¸²Àº ÀνºÅϽºµÇ°í ´ÝÈ÷´Â °ÍÀ» ¹Ýº¹ÇÏ°Ô µË´Ï´Ù.

½ºÆ®¸²À» ¸Å¹ø ÀνºÅϽºÈ­ÇÏ´Â °ÍÀº ½ºÆ®¸²ÀÇ SQL ¹®ÀåÀ» ´Ù½Ã ÆÄ½ÌÇϵµ·Ï µ¥ÀÌŸº£À̽º backend¿¡ Áö½ÃÇÏ°Ô µË´Ï´Ù. ÀÌ´Â ºñ±³Àû ºñ¿ëÀÌ ¸¹ÀÌ µå´Â ¸í·ÉÀÔ´Ï´Ù. ½ºÆ®¸² Ç®¸µ ÀåÄ¡´Â ÀÌ·¯ÇÑ ºÎ´ãÀ» ÁÙ¿©ÁÖ°í ÄÚµùÀ» ´Ü¼øÇÏ°Ô ¸¸µé¾îÁÝ´Ï´Ù.

½ºÆ®¸² º¯¼ö°¡ ´ÝÈú ¶§, ½ÇÁ¦ otl_stream ÀνºÅϽº´Â ½ºÆ®¸² Ç® ³»¿¡ ÀúÀåµË´Ï´Ù. ±×·± ´ÙÀ½, ºñ½ÁÇÑ OTL ½ºÆ®¸² ¿äûÀÌ µé¾î¿À¸é OTL ½ºÆ®¸² º¯¼ö´Â ÇÔ¼ö¿¡°Ô ¼±¾ðµÈ Áö¿ªº¯¼öÀ̰Ç, Èü¿¡ ¼±¾ðµÈ º¯¼öÀ̰ǰ£¿¡ ¼±¾ðµÈ otl_stream º¯¼ö¿¡ ´ëÀԵ˴ϴÙ. ½ºÆ®¸²µé°£ÀÇ ºñ½ÁÇÏ´Ù¶ó´Â ±âÁØÀº (½ºÆ®¸²¹öÆÛÅ©±â+SQL¹®ÀÚ¿­)·Î¼­ Á¤ÀǵǸç, À̰ÍÀº °°Àº ¹öÆÛÅ©±â¿Í µ¿ÀÏÇÑ SQL ¹®ÀåÀ» °¡Áø ½ºÆ®¸²Àº ½ºÆ®¸² Ç®ÀÇ °°Àº ÀúÀå°ø°£¿¡ ÀúÀåµÉ °ÍÀ̶ó´Â °ÍÀ» ÀǹÌÇÕ´Ï´Ù.

Say, three instances of similar streams of <buf_size1+SQLStm1> were allocated and then all of them were closed. The pool will have one entry point for all the three and the actual bodies of the instances will be placed in the same bucket (see the diagram below). After that, the functions, in which the streams had been created, get called on the second iteration of a loop, and the corresponding otl_stream variables get instantiated again. The second time around, the instances of the similar streams, which were previously saved in the pool, will be pulled out of the pool and re-assigned to the variables, until the variables get closed again.

In some cases, an instance of a stream, if it is, say, used only once, can bypass the pool and be destroyed without saving it in the pool. The otl_stream::close() function has extended functionality to allow the developer to do that.

If the stream pooling is undesirable, then the OTL code, which implements the pooling, can be turned off (not turned on at all). This is controlled by a conditional compilation directive, since OTL is a C++ template as well as macro library with a lot of conditional compilation directives in it, for efficient code generation.

The stream pool has a fixed maximum size, that can be changed by the otl_connect::set_stream_pool_size() function. And, as it already should be obvious from the description above, the stream pool is a property of the otl_connect object.

The implementation of the stream pool was made with the help of STL containers, maps and vectors in particular. Therefore, #define OTL_STL needs to be enabled in order to turn on the OTL code in the STL compliance mode.

From the statistic that I (Sergei Kuchin) was able to gather, the stream pooling has very little overhead (2-4%), compared to the use of otl_stream's, which are kept open always, and don't get closed. This is due to the fact that the std::map<>, as an STL data container, is performant enough.

http://otl.sourceforge.net/pool.gif


EditText | FindPage | DeletePage | LikePages

Powered by MoniWiki
xhtml1 | css2 | any browser | rss
Last modified 2004-12-30 22:48:16
Loading 0.0647 sec