Manassorn
Something about everything and everything about something
วันพุธที่ 6 ตุลาคม พ.ศ. 2564
วันอาทิตย์ที่ 6 ตุลาคม พ.ศ. 2556
Grails: ConfigSlurper Memory Leak
Last month, my team started load-testing a project which using Grails framework. Unexpected result happened, while it's load-tested for a couple of hour. "Out of memory" exception occurred in the log file. Firstly, my team suspected that jvm has low memory because what I'd search from internet said that Grails need minimum memory at 512mb when my server has 2 Grails-war in 512mb. But when memory’s incresed to 768mb, it’s still throw “Out of memory” exception. So we suspected which instance consume all of our memory.
We use VisualVM to investigate our CPU usage and memory usage. In the above picture, you’ll see that memory usage increase rapidly from 500mb to 768mb, maximum allowed memory, and never decrese although GC process.
From Heap histogram view, we see that org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry used all of our memory. We found that many of these instances reference to ConfigSluper$_parse_closure5.
When we search “grails configsluper memory leak” in google, we found some people have same problem with us. The blog that we found is below.
http://stackoverflow.com/questions/14200415/grails-configslurper-memory-leak
So we fix how we create ConfigSlurper and this is the result.
Viola!
We use VisualVM to investigate our CPU usage and memory usage. In the above picture, you’ll see that memory usage increase rapidly from 500mb to 768mb, maximum allowed memory, and never decrese although GC process.
From Heap histogram view, we see that org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry used all of our memory. We found that many of these instances reference to ConfigSluper$_parse_closure5.
When we search “grails configsluper memory leak” in google, we found some people have same problem with us. The blog that we found is below.
Viola!
Log4j didn't work when use Grails 2.2.1 with Jboss AS 7.1.1
I’ve found that grails 2.2.1 has some issue with Jboss AS 7.1.1. Since this version of Jboss include some of logging libraries, grails will use libralies of Jboss instead of its own. So log doesn’t print into file that I’ve set in config.groovy. To solve this problem I’ve to change jboss-deployment-structure.xml such the below setting.
วันเสาร์ที่ 5 ตุลาคม พ.ศ. 2556
Useful git command
git clone <URL>
git rm file.txt
git rm --cached file.txt
git rm -r directory
git rm -r --cached directory
git add -u .
git branch -b dev origin/dev
git push <REMOTENAME> <BRANCHNAME>
# Ignore everything in this directory
*
# Except this file
!.gitignore
git rm file.txt
git rm --cached file.txt
git rm -r directory
git rm -r --cached directory
git add -u .
git branch -b dev origin/dev
git push <REMOTENAME> <BRANCHNAME>
# Ignore everything in this directory
*
# Except this file
!.gitignore
วันจันทร์ที่ 29 กรกฎาคม พ.ศ. 2556
Drawer แบบ Gmail, Youtube, Facebook
ลองเขียนเป็นโพสต์แรก :)
พอดีเห็นช่วงนี้แอพไหนๆ ก็มี Drawer กันหมด อย่าง Gmail, YouTube, Facebook ก็เลยอยากทำบ้าง
พอ search google ปุ๊ปก็เจอ SlidingDrawer เลย ก็เลยนั่งอ่านอยู่ตั้งนาน ไปเจอว่ามัน deprecated ไปละ link
ก็ทำตามตัวอย่างเลย แต่ผลออกมาไม่เห็นเหมือนอย่างที่ต้องการ คือ 1.
1. ต้อง hide actionbar แล้วก็สร้าง view ที่หน้าตาเหมือน actionbar ขึ้นมาเอง
ก็จะได้ผลลัพธ์ที่ต้องการ
พอดีเห็นช่วงนี้แอพไหนๆ ก็มี Drawer กันหมด อย่าง Gmail, YouTube, Facebook ก็เลยอยากทำบ้าง


พอ search google ปุ๊ปก็เจอ SlidingDrawer เลย ก็เลยนั่งอ่านอยู่ตั้งนาน ไปเจอว่ามัน deprecated ไปละ link
This class was deprecated in API level 17. This class is not supported anymore. It is recommended you base your own implementation on the source code for the Android Open Source Project if you must use it in your application.API ที่ต้องใช้ก็คือ DrawerLayout
ก็ทำตามตัวอย่างเลย แต่ผลออกมาไม่เห็นเหมือนอย่างที่ต้องการ คือ 1.
- actionBar ข้างบนมันไม่เลื่อนไปด้านขวาตาม drawer 2.
- drawer มันทับ content ด้านล่าง ถ้าตามแอพอื่นมันต้องเลื่อนไปด้านขวาด้วยเหมือนกันซิ
1. ต้อง hide actionbar แล้วก็สร้าง view ที่หน้าตาเหมือน actionbar ขึ้นมาเอง
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getActionBar().hide(); }
2. ต้องใช้ DrawerListener อ้อแล้วก็เซ็ท scrim color เป็น 0 ด้วยจะได้ transparent เหมือนแอพอื่น
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drawer); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setScrimColor(0); mDrawerLayout.setDrawerListener(this); } public void onDrawerSlide(View drawerView, float slideOffset) { contentFrame.setX(slideOffset * mDrawerList.getMeasuredWidth()); }
ก็จะได้ผลลัพธ์ที่ต้องการ
วันพุธที่ 24 กรกฎาคม พ.ศ. 2556
สมัครสมาชิก:
บทความ (Atom)